Proper way to reload a python module from the console

前端 未结 8 1937
迷失自我
迷失自我 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 05:05

    As of Python 3.4 you can use importlib.reload(module)

    >>> from importlib import reload
    >>> from project.model import user
    >>> reload(user)
    

提交回复
热议问题