4

Within ipython notebook I call a function imported from my own module and run some code. I have noticed that if I change the code in the function (outside of notebook) and execute the notebook the old version of the function runs.
Either ipython notebook or firefox seems to be caching the module which I can clear with ctrl-F5, when I remember. Is there an ipython notebook function call to ensure I am running the newest code?

1 Answer 1

9

Put in the following two cells at the beggining of your code and it will automatically reload any new version of your code:

%load_ext autoreload
%autoreload 2
import ...
2
  • I recreated the problem and then verified that this works. Where did you come across this? Thanks.
    – Scott
    Apr 21, 2015 at 15:39
  • I don't remember. I had this problem a long time ago. And after researching the internet, that was the best solution I could find. Glad it worked for you. Apr 21, 2015 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.