Reloading modules in a Juypter notebook with autoreload
- as shown in this this video - does not work on my local WinPython distribution (3.8.5 or 3.10.9).
However on Linux is does work. Might the problem be WinPython?
More specifically I have a file my_new_file.py
:
print("import my_new_file.py")
def my_function():
print("bar")
and a notebook in the same directory:
# Cell 1:
%load_ext autoreload
%autoreload 2
# Cell 2:
from my_new_file import my_function # Outputs: "import my_new_file.py".
# Cell 3:
my_function() # Outputs "bar".
# Cell 4:
# Before running this cell, I changed my_function()
# in my_new_file.py to return "foo" instead of "bar".
my_function() # Outputs "bar" instead of "foo".