1

Let's assume we have the following package structure.

module
 __init__.py
 +--> submodule
      __init__.py
      +--> subsubmodule
      __init__.py
      importantstuff.py

Classes from importantstuff can be imported by writing from module.submodule.subsubmodule.importantstuff import ImportantClass.

If I put that line in the module level __init__.py then importing can be shorten to from module import ImportantClass.

Now, if I use that shortcut in combination Autoreload IPython Magic commands:

In [1]: %load_ext autoreload

In [2]: %autoreload 2

Changes in the class ImportantClass will no longer automatically picked up.

Is there a workaround?

Joachim
  • 11
  • 2

0 Answers0