from mypackage.pkg import mymodule
...
reload(mypackage.pkg.mymodule)
结果为NameError: global name 'mypackage' is not defined.
如何重新加载mymodule?
答案 0 :(得分:8)
from mypackage.pkg import mymodule
reload(mymodule)
或
import mypackage.pkg.mymodule
...
reload(mypackage.pkg.mymodule)