Detect if a python module changes and then reload Detect if a python module changes and then reload python python

Detect if a python module changes and then reload


Detect File Change Without Polling

Coupled with you already knowing how to reload your module this answer pretty much fills it out. It uses Inotify to "notify" (see what they did there) the program when the file is modified.


I would look at all of the files, and detect if a file was modified. If it was, I would reload it.


It's an old question, but if you stumble upon it, here is a solution if you use IPython:

Enter the following lines in the IPython prompt at any time

%load_ext autoreload%autoreload 2

For more options, check out this link:https://ipython.readthedocs.io/en/stable/