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 A:
def __init_(self):
pass
def Message(self):
print "1"
then I start Python shell in the linux, and execute the following code:
>>> from test import A
>>> a = A()
>>> a.Message()
1
Now I vi the test.py in the fly, and change the method "Message":
class A:
def __init_(self):
pass
def Message(self):
print "2"
but when I execute the a.Message() in the Python shell, the result is always the "1" and not "2"
How I write the code to make the object 'a.Message' to execute the updated code.
Thank you very much!
chu