Proper way to reload a python module from the console

前端 未结 8 1936
迷失自我
迷失自我 2020-12-03 04:51

I\'m debugging from the python console and would like to reload a module every time I make a change so I don\'t have to exit the console and re-enter it. I\'m doing:

<
8条回答
  •  一向
    一向 (楼主)
    2020-12-03 04:57

    You can't use reload() in a effective way.

    Python does not provide an effective support for reloading or unloading of previously imported modules; module references makes it impractical to reload a module because references could exist in many places of your program.

    Python 3 has removed reload() feature entirely.

提交回复
热议问题