Reputation: 96264
Say I have a script that imports various modules in Python.
import my_module
from some_other_module import foo
...
I then run this script from IPython.
Say I make changes to the function bar
in my_module
and foo
in some_other_module
.
Say that I now want to interactively call either my_module.bar()
or foo()
from my IPython session.
ipython_config.py
(startup file) so that it supports this functionality off-the-shelf?Upvotes: 0
Views: 311
Reputation: 27843
I would suggest a %load_ext autoreload
followed by a %autoreload?
to see how to use it.
You can also have a look at InteractiveShellApp.extensions
and InteractiveShellApp.extra_extension
configuration options for extension at startup.
Finally, you can also add a .py
file in your IPython profile dir ($ ipython locate
to get it), put it in the startup
subfolder, it will be executed at startup time.
There is a restriction though, C modules cannot be reloaded.
Upvotes: 3