I\'m find a way to reload the method of a class object at runtime,here is the example: I have define a class A firstly which lies on the file test.py.
class
To relaod your module in the interactive interpreter, you can use
import test
reload(test)
from test import A
But this won't affect instance of A which already exist -- they will still be of the old type A, hence having the old method. I think it is not possible to change existing instances, nor do I think it is a good idea.
By the way, I would recommend using IPython for code testing. It facilitates recursive reload using the %reload magic, and (even more useful) the %run magic to test modules.