But this approach only deletes the direct module you refer to. Any other
existing modules that might have imported the library will still have a
live reference to the old one. To really do a "deep reload" you have to
recurse down all of the dependencies that had been imported, and reload
anything else that might have loaded your original target module. On top of
that, compiled extensions can't be reloaded.



On Thu, Aug 21, 2014 at 8:47 PM, Cesar Saez <[email protected]> wrote:

> I've been manually removing modules from python cache during years without
> issues, I use it so often that I made a GUI helper to ease the process :)
> http://cesarsaez.me/2014/08/hard-reloader.html
>
>
>
> On Thu, Aug 21, 2014 at 3:55 AM, Fredrik Averpil <
> [email protected]> wrote:
>
>> I never got the sys.modules deleting approach to work (tried it about a
>> year ago in python 2.6). As far as I understand you’re not supposed to
>> delete imported modules. That’s not how Python is designed to work.
>>
>> Instead I just always (yes, always) import modules with a reload() as
>> well:
>>
>> import myModule
>> reload(myModule)
>>
>> Then I make sure to always delete the UIs (and dockControls in Maya)
>> properly before loading up the UI. This makes it possible to reload the
>> whole pyqt/pyside app without issues and without having to restart
>> Maya/Nuke. Example of this in Maya/Nuke here
>> <https://github.com/fredrikaverpil/pyVFX-boilerplate/blob/master/boilerplate.py>
>> .
>>
>> Regards,
>> Fredrik
>>
>  --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CAPamJi-oj10Ld5ojC%2BQYQD6AVpwF0HE_C-eL%2Bay9h%3DE%3DpDM5BQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAPamJi-oj10Ld5ojC%2BQYQD6AVpwF0HE_C-eL%2Bay9h%3DE%3DpDM5BQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0OZD%3DDMusR8VFKpeErdh4Vgvbbk%2BWSKb3q_AKHh3RG0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to