Executing a modified function

Laura Creighton lac at strakt.com
Thu Jan 2 16:23:30 EST 2003


> If I enter python and run a funtion, then I modify it and try to run it
> again, it appears I execute the old version.  Is there a way to force the
> new version to be executed in this situation, without leaving python and
> starting again?
> 
> Dave

If you are keeping your function in a module, you can do this:

from mymodule import myfunc
myfunc()

# ok, now you hack on myfunc a bit

reload(mymodule)
from mymodule import myfunc
myfunc() # back in business again

Laura Creighton





More information about the Python-list mailing list