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
​


On Fri, Jul 18, 2014 at 8:51 PM, Erdinç Yılmaz <[email protected]>
wrote:

> (If i understood correctly)
>
> Let's say we have a myQtApp script or class,
> and also, maybe subclasses which we import in myQtApp.
>
> After we make some changes in our code,
> using this piece of code and then reimporting works.
> You don't need to exit from maya.
> But you need to use it for all your modules or files which you make
> changes!
>
>
> import sys
>
> def flushModule(name):
>     if sys.modules.has_key(name):
>         del(sys.modules[name])
>
> flushModule("myQtApp")
> flushModule("someClassYouImportedToMyQtApp")
> flushModule("sub.mySubLineEdit")
> flushModule("sub.myTreeModel")
>
> # and then reimport myQtApp in maya.
>
> import myQtApp
>
>
>
> On Tuesday, July 15, 2014 7:22:29 PM UTC+3, md wrote:
>>
>> Is there a way to flushing all prior QT instances from memory when
>> developing PySide/Qt scripts for Maya?
>>
>> I am constantly exiting Maya and reloading it when my forms don't seem to
>> refresh properly.
>>
>> Thanks
>>
>> M
>>
>  --
> 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/0f26a930-db5a-4656-87dd-fc0de62df0e3%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/0f26a930-db5a-4656-87dd-fc0de62df0e3%40googlegroups.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/CAD%3DwhWMw0otXQ_Th9fh0uODVhOv8AiSOTHbgt4pS5yFoEwWitg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to