2
from mypackage.pkg import mymodule
...
reload(mypackage.pkg.mymodule)

结果是NameError: global name 'mypackage' is not defined.

应该如何重新加载 mymodule?

4

1 回答 1

8
from mypackage.pkg import mymodule

reload(mymodule)

或者

import mypackage.pkg.mymodule
...
reload(mypackage.pkg.mymodule)
于 2012-11-13T19:29:41.010 回答