# There's also this:
import sys
def clearModules(moduleNames):
if not hasattr(moduleNames, "__iter__"):
moduleNames = [moduleNames]
for m in sys.modules.keys():
for n in moduleNames:
if n in m and sys.modules[m]:
print ("Clearing %s, %s" % (m, sys.modules[m]))
del sys.modules[m]
# then:
import sys, os, maya
# removes them from the session (kinda... you might have objects still in
the session)
clearModules("sys")
clearModules(["os", "maya"])
# reloads them fresh
import sys, os, maya
This way means that any other modules that import these modules will cause
them to refresh ,and they won't require a 'reload' statement of their own.
On Thu, Jan 22, 2009 at 1:35 AM, Sebastian Thiel <[email protected]>wrote:
>
> Hi Chris,
>
> It never worked for me ( properly ), so I don't trust it anymore.
> Whenever I develop UIs, I usually start Maya in UI mode from the
> commandline, without bringing up the main UI by setting MAYA_OVERRIDE_UI
> to my own ui script. This will just init the script editor.
>
> A testcase specially made to deal with the ui mode will then bring up my
> UI and use the UIs api to trigger actions. Of course, at some point you
> will end up clicking the UI yourself a bit, but in general, testcases,
> even for UI, are a great thing ( to me ).
>
> Remembering the MEL days, sourcing is still a nice thing to have, if
> reload works for you it's good as well and still faster than cranking up
> a fresh maya all the time.
>
> In the end it depends on the specific issue that you have to solve I guess.
>
> Sebastian
>
> >
>
--
- Ofer
www.mrbroken.com
--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---