'How to reload a module that was loaded by another module?
I have an intermediate module that serves as an export_file, however, at development time, I couldn't figure out how to reload everything that the export_file has imported.
main_module.py
def func1(): print("func1")
# def func2(): print("func2) # to be uncommented later for testing if reload worked.
export_file.py
from main_module import * # for sake of simplicity.
Finally, main_file.py
from export_file import as exp # for simplicity
Now, if func2 is uncommented, how can I feel the impact on main_file.py?
I tried reload, importlib, runpy modules, run them everywhere, added a special function inside export_file for this purpose, but I couldn't get it to work, neither for love nor for money.
EDIT:
exact sequence of commands ran in main_file interactive console
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
