When I import a class MyClass from a file myModule.py from with a myModules dictionary i do it like
from myModules.myModule import MyClass
How to reload this module after I have made changes to the file myModue.py? Here are some mistrials:
reload(MyClass) # TypeError: reload() argument must be module
reload(myModule) # NameError: name 'myModule' is not defined
reload(myModules.myModule) # NameError: name 'myModules' is not defined
You must have a module to reload. when you use the
from foo import bar, unlessbaris a module (it looks like it isn’t, in your case) you will have to use another import statement.If, for some reason, you don’t want two imports, the already imported module can also be found in
sys.modules