2

I'm just learning IPython Notebook, using a pre-existing Python library I've written. At the beginning of my notebook, I'm importing it in the normal way.

However, I'm still modifying this library. I notice that changes I'm making to it don't seem to be reflected, even when I reload the notebook in the browser.

How can I force a reload of the library from inside IPython notebook?

1 Answer 1

4

Use the magic autoreload to get your module refreshed automatically as you edit it.

For instance, if you develop a module called mylibrary:

%load_ext autoreload
%autoreload 1
%aiimport mylibrary

will automatically reload the module mylibrary.

You can ask to get all modules automatically reloaded with:

%autoreload 2
Sign up to request clarification or add additional context in comments.

2 Comments

And if you prefer to do it manually rather than reloading everything automatically, importlib.reload() is what you want.
Thanks. That's what I was looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.