Actually in development I have had the same need. If I am working on a tool
and it imports a few other modules in the same tool, and I make a change to
those modules, I have to kill the changed dependencies and the top level
tool to get the changes reflected.  If you are testing a tool that consists
of one file, and you only make changes to one file, then you wouldn't need
to worry about killing multiple imports.
 On 22/08/2014 5:54 AM, "Cesar Saez" <[email protected]> wrote:

> Hi Justin,
> I assumed we were talking about reloading during the development stage
> where you will most likely code your library as a package (there's no need
> to reload all dependencies) and have access to the source code as you're
> the one developing it, under those conditions removing modules from
> python's cache works way better than any kind of import hook (we managed
> the cache through a hook at my previous job and it was a nightmare!).
>
> Cheers!
>
> On Thu, Aug 21, 2014 at 5:02 AM, Justin Israel <[email protected]>
> wrote:
>
>> 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
>>>
>>>  --
> 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/CAPamJi9AG-PJAF9ntTwKP5AER1M_jvpPDL19jS8pYM_vMWuUzg%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAPamJi9AG-PJAF9ntTwKP5AER1M_jvpPDL19jS8pYM_vMWuUzg%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/CAPGFgA3ZsPc2_zucuGEaZomb_XXNn3pFzpEsecWuZJ5tZxBVMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to