python - How to force IPython to see an updated library? -


i following in ipython notebook:

import sys sys.path.append('my_directory') db import * 

it works fine. added new function db.py , ipython not see it. ok. not see if reset end re-execute cell imports everything. not see if user reload. not see if close ipython notebook , restart it.

what way force ipython (or python) see updated content of file?

you need use autoreload. check manual @ http://ipython.org/ipython-doc/dev/config/extensions/autoreload.html. seems need:

%autoreload 2 

the above automatically reload imported modules. except inlcuded in separate special list of modules specified %aimport modulename. autoreloaded if specify %autoreload 1.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -