how to reload a Class in python shell?

On Python 3 only, import the reload function:

>>> from importlib import reload

On both Python 2.x, and 3.x, you can then simply call reload on the module:

>>> import MyPak
>>> reload(MyPak)
>>> from MyPak import MyMod

However, instances of the old class will not be updated (there’s simply no code that describes the update mechanism).

Leave a Comment