Autoreload other python files if they've been imported
See original GitHub issueUser scenario:
User has two files, foo.py and bar.py.
They are working in foo.py and they run this cell
from bar import my_func
my_func()
Then they go to bar.py and modify my_func().
They run a cell like so:
#%%
my_func()
It would be nice if my_func automatically picked up the changes from bar without having to redo the import.
The autoreload magic does this already. https://ipython.readthedocs.io/en/stable/config/extensions/autoreload.html
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:13 (8 by maintainers)
Top Results From Across the Web
Autoreload other python files if they've been imported #1542
User scenario: User has two files, foo.py and bar.py. They are working in foo.py and they run this cell from bar import my_func...
Read more >Automatically Reload Modules with %autoreload
If you already imported a module ( import a_module ) or a function ( from a_module import a_function ) in your Python session...
Read more >Reloading submodules in IPython - Stack Overflow
IPython comes with some automatic reloading magic: %load_ext autoreload %autoreload 2. It will reload all changed modules every time before executing a new ......
Read more >Jupyter / IPython: After editing a module, changes are not ...
1) The simplest and most certain is to restart the ipython kernel after changing an imported module. But this has downsides as well,...
Read more >9.8. Reload modified modules — itom Documentation - Bitbucket
Usually, script files (hence modules) that are imported by another script in python are pre-compiled and cached for a faster execution once ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is an option in the preferences to run startup commands for Interactive Python. Mine is set to
"python.dataScience.runStartupCommands": "%load_ext autoreload\\n%autoreload 2"
☝️ Syntax has been updated, it’s
"python.dataScience.runStartupCommands": ["%load_ext autoreload","%autoreload 2"]