Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I reload objects in my namespace in ipython [duplicate]

Tags:

After import functions into ipython, how do I reload them when I have modified them outside of ipython ?

like image 340
Frankie Ribery Avatar asked Jun 21 '11 04:06

Frankie Ribery


People also ask

How do I reload a module in IPython?

Simple solution: Use the autoreload to make sure the latest version of the module is used. The autoreloading module is not enabled by default. So you have to load it as an extension. And each time you execute some code, IPython will reimport all the modules to make sure that you are using the latest possible versions.

How do I reload a python module?

Python ProgrammingThe reload() is used to reload a previously imported module or loaded module. This comes handy in a situation where you repeatedly run a test script during an interactive session, it always uses the first version of the modules we are developing, even we have made changes to the code.

What is Autoreload in IPython?

IPython extension to reload modules before executing user code. autoreload reloads modules automatically before entering the execution of code typed at the IPython prompt.


1 Answers

Python 2:

reload(module) 

Python 3:

from importlib import reload reload(module) 

Where module is the file with your functions.

like image 116
JBernardo Avatar answered Sep 21 '22 11:09

JBernardo