how to reload a Class in python shell?

后端 未结 6 1869
既然无缘
既然无缘 2020-12-07 10:47

If I import a module defining a class of the same name belonging to a package, it is imported as a Class, not a Module because of the __init__.py of the parent package. See

6条回答
  •  余生分开走
    2020-12-07 10:51

    It works for me using python 3.5.2:

    import importlib
    importlib.reload(class)
    from class import module
    

提交回复
热议问题