Issue
Beginners question. I have started my iPython shell and I am running scripts with the run-command and everything works great. However running a script file and then editing a imported script file and then trying to run it again causes the old imported file to run. So I am guessing python saves some kind of cache for speed. I've tried clear command and such but to no avail.
Basically my problem is this. Two files: function.py and program.py. The program file imports the function. But running the program and then editing the function and then running the program again causes the old function/un-edited version to run.
Solution
Inside of iPython or the standard Python interpreter, you can use the reload()
function to reload an imported module.
Example:
In [1]: import foo
# make some changes to the foo.py
In [2]: reload(foo)
Answered By - Garrett Hyde
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.