Reloading function obtained via 'from xxx import yyy'

Joel Koltner zapwireDASHgroups at yahoo.com
Fri May 23 15:40:04 EDT 2008


How do I get Python to correctly re-load this function definition?

In test.py:

def testFunc():
    print 'My testFunc!'

I execute...

>>> from test import testFunc
>>> testFunc()
My testFunc!

Fine... now I change test.py to:

def testFunc():
    print 'Modified testFunc!'

...and I'd like to reload testFunc.  How do I do so?  'from test import 
testFunc' keeps the old definition around, and 'reload test' of course doesn't 
work becayse I didn't use 'import test' in the first place.

Thanks for the help,
---Joel






More information about the Python-list mailing list