import moduleName
reload (moduleName)
from moduleName import className # doing * didn't work!
reload(moduleName) # ??... just trying crazy things
....
Make sure you don’t have a .pyc version of your script lying around. And while you’re at it, disable the generation of those buggers permanently by setting PYTHONDONTWRITEBYTECODE
to 1 in your environment. It’ll make sure you keep the hair on your scalp. :)
You need to reload(className)
Even though you reloaded moduleName
ClassName is not getting reloaded in globals.
Reload won't work with import * unless you write code to remove all the objects from globals that import * creates first
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAAB1%3D8wWQztaW0PwvXfAvrkEg7fyCdHq81-tuiwjH7_eZW4H%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
PYTHONDONTWRITEBYTECODE
stuff , i'll see how that works. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAM9RXoKJxNorAqROtFwY-G4btreFEjOoNxjNzN2GXZ32C7GWVw%40mail.gmail.com.
The PYTHONDONTWRITEBYTECODE
will only have an effect for newly compiled files. If this is the problem, you’ll need to manually remove the existing pyc
file first.
If you print
your module, you’ll see where it exists on disk, the .pyc
file might lie right next to it. It’s also possible that you’ve got two modules with the same name in your PYTHONPATH, which would explain why you can import it, but not see the changes you make to the other one.
If you
.pyc
file might lie right next to it. It’s also possible that you’ve got two modules with the same name in your PYTHONPATH, which would explain why you can import it, but not see the changes you make to the other one.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOC0jpt2BypPrg3XjHUpcS%3DEExZPng7jT4Aj%2B_210KnWXg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA14%3DTZY4hB0F0i1RT9%2B66oagFVd95Q9z5PN_s-UGNE9fg%40mail.gmail.com.
The execfile is just a standard python builtin :
https://docs.python.org/2/library/functions.html#execfile
The plugin uses it to create a namespace specifically for the plugin, and execs the file under it to avoid affecting the main namespace of Maya, and to let it be persistent across calls.
https://github.com/justinfx/MayaSublime/blob/master/MayaSublime.py
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAAB1%3D8w-Wx%2BO3OToMxt%2BFO%2BJRVjHFS8iGTgeh2gz_bC6s%3Df1vA%40mail.gmail.com.
This still works great for me:
https://groups.google.com/d/msg/python_inside_maya/sNqxa2yDt5s/CC9MNpFni50J
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPamJi-d0zdmoqZZ9xPuTfcCZ%3DGxtmvBsn6XAO_KmOL3uVoteg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3q4jsraEF1pVEb3GSS2Kw6cyR0KwNsJHgs-cnFPwaRzA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
On Mon, 23 Feb 2015 11:54 PM Lidia Martinez <darksi...@gmail.com> wrote:
Cesar, that looks great.
This catched my attention.
"If a module instantiates instances of a class, reloading the module that defines the class does not affect the method definitions of the instances — they continue to use the old class definition. The same is true for derived classes."
Does it mean the class is not reloaded?, as someone said in the list?. Reload has some caveats i'm curious about...
Yea this is a caveat. Reloading won't help if other modules hold references to objects. All of the modules either have to be completely reloaded, or they have to access other modules though the module object.
--
Lidia2015-02-23 11:32 GMT+01:00 Cesar Saez <ces...@gmail.com>:
This still works great for me:
https://groups.google.com/d/msg/python_inside_maya/sNqxa2yDt5s/CC9MNpFni50J--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPamJi-d0zdmoqZZ9xPuTfcCZ%3DGxtmvBsn6XAO_KmOL3uVoteg%40mail.gmail.com.For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAAB1%3D8z3yD6gWT0MtD2f%2Bb%2BOOY00y5_0EVpwVXr%3DDnqp7QXkGg%40mail.gmail.com.