ghPython reloading modules

Hi,
I’am maintaining some IronPython classes from Visual Studio. I’am trying my ghpython component to be aware of changes made from VS on the modules it is importing. For this, i´am using reload() method from Standard Library, but it doesn’t work, not sure why. My code looks like this:

import inspect
import myNamespace
import myNamespace.MyModule as modul
reload(myNamespace)
reload(myNamespace.modul)
import myNamespace
import myNamespace.MyModule as myModul

attrs = [attr for attr in dir(myModul.myClass) if not inspect.ismethod(attr)]
for attr in attrs:
     print attr

When I add a new attribute to myClass in Visual Studio, I need to restart Rhino in order to ghpython detect the changes. Am I somehow missusing reload method? It seemed straightforward but I cant make it work…
Any help would be appreciated
thanks
leceta

sorry, my bad. The code is right. VS was not overriding my *.py file. I should double checked this…
thanks
leceta

1 Like