I have a module folder organised as follow:
Hello\
__init__.py
world.py
The __ init __.py file contains:
from . import world
and the world.py
def world():
print('Hello world!')
In a IPython console I can then do
In [1]: import Hello
In [2]: Hello.world.world()
Hello world!
However if I add a new function to world.py this is NOT reloaded by the IPython console. Moreover, if I add a module to Hello\ this is not loaded either, also adding the "from . import world2" to __ init __.py .
Not only! If I modify the function world in the world.py file, this is not reloaded either!
I tried to solve the problem with %autoreload obviously, but this does not seams to work inside modules.
Am I missing a piece of the puzzle? Do I have to open a new console every time I update a module? Should I develop the module "from the inside"?
I looked at this question, but it seams to suggest that %autoreload 2 should work, while it is not for me. Moreover also the other solution
reload(Hello)
does not works and returns
NameError: name 'reload' is not defined