title: Jupyter / IPython: After editing a module, changes are not effective even with kernel restart
body: <p>I'm writing some code in a Jupyter notebook, and for some reason it is not recognizing when I've made changes to a module that the notebook imports.</p>
  
  <p>I have the following cell at the top of my Jupyter notebook:</p>
  
  <pre><code>%load_ext autoreload
  %autoreload 2
  </code></pre>
  
  <p>Based on <a href="http://ipython.readthedocs.io/en/stable/config/extensions/autoreload.html" rel="nofollow noreferrer">this</a>, my understanding is that this cell will force modules to reload upon execution of any code within the notebook. Meaning if I edit one of my imported modules, the edit should be reflected next time I run the code.
  Even without this cell though, I should be able to restart the module and run each cell from scratch to the same effect. Unfortunately this is not the case. No matter how many times I kill/restart the module, or even completely shut down Jupyter notebooks, the notebook will not recognize the changes I've made to the module(s) in question.</p>
  
  <p>I'm working in a virtual environment, and so far the only solution I've found is to run a script that completely rebuilds the environment (including re-downloading packages, etc). This is a pain, and a much bigger waste of time than should be necessary.</p>
  
  <p>This behavior is relatively new. I've been using Jupyter notebooks on this environment for months without such problems, but I can't pinpoint what I may have changed to cause this new behavior.</p>
  
  <p>Any insight would be greatly appreciated.</p>
  
  <p>Edit - Let me give a quick illustration of such a problem:</p>
  
  <p>Say, in a module called <code>foo.py</code> I have a class:</p>
  
  <pre><code>class Foo(object):
      foo_bool = True
  </code></pre>
  
  <p>And in my notebook I have the cell:</p>
  
  <pre><code>from foo import Foo
  </code></pre>
  
  <p>Then later I add to <code>foo.py</code>:</p>
  
  <pre><code>class Foo(object):
      foo_bool = True
  
  
  class Bar(object):
      bar_bool = False
  </code></pre>
  
  <p>And I now want to import both classes, so I change the notebook cell to:</p>
  
  <pre><code>from foo import Foo, Bar
  </code></pre>
  
  <p>Instead of properly importing both classes, I get something like:</p>
  
  <pre><code>---------------------------------------------------------------------------
  ImportError                               Traceback (most recent call last)
  &lt;ipython-input-2-1d0ce6099263&gt; in &lt;module&gt;()
        1 import some_module
        2 import some_other_module
  ----&gt; 3 from foo import Foo, Bar
        4 from yet_another_module import Thing
        5 from the_last_module import TheLastThing
  
  ImportError: cannot import name Bar
  </code></pre>
  
  <p>Thanks again for the help!</p>