title: How do I solve a KeyError when importing a python module?
body: <p>I was trying to import a module from a different directory level so I used:</p>
  <pre><code>import os
  import sys
  sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
  </code></pre>
  <p>But now I get this error. I'm using Spyder and the first time I use the following import, it works fine.</p>
  <pre><code>from source.search.ci_search_project import CI_Search_Project
  </code></pre>
  <p>From the second time I get this error.</p>
  <blockquote>
  <p>File &quot;ipython-input-29-f35dfe634c32&quot;, line 1, in module
  &gt;runfile('C:/Users/nrshakya/Documents/CI/src/Comp_IntelPython/ci_search_project_test.py', wdir='C:/Users/nrshakya/Documents/CI/src/Comp_IntelPython')</p>
  </blockquote>
  <blockquote>
  <p>File &quot;C:\Users\nrshakya\AppData\Local\Continuum\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py&quot;, line 880, in runfile
  execfile(filename, namespace)</p>
  </blockquote>
  <blockquote>
  <p>File &quot;C:\Users\nrshakya\AppData\Local\Continuum\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py&quot;, line 102, in execfile
  exec(compile(f.read(), filename, 'exec'), namespace)</p>
  </blockquote>
  <blockquote>
  <p>File &quot;C:/Users/nrshakya/Documents/CI/src/Comp_IntelPython/ci_search_project_test.py&quot;, line 8, in module
  from source.search.ci_search_project import CI_Search_Project</p>
  </blockquote>
  <blockquote>
  <p>File &quot;frozen importlib._bootstrap&quot;, line 961, in _find_and_load</p>
  </blockquote>
  <blockquote>
  <p>File &quot;frozen importlib._bootstrap&quot;, line 946, in _find_and_load_unlocked</p>
  </blockquote>
  <blockquote>
  <p>File &quot;frozen importlib._bootstrap&quot;, line 885, in _find_spec</p>
  </blockquote>
  <blockquote>
  <p>File &quot;frozen importlib._bootstrap_external&quot;, line 1157, in find_spec</p>
  </blockquote>
  <blockquote>
  <p>File &quot;frozen importlib._bootstrap_external&quot;, line 1123, in _get_spec</p>
  </blockquote>
  <blockquote>
  <p>File &quot;frozen importlib._bootstrap_external&quot;, line 994, in <strong>iter</strong></p>
  </blockquote>
  <blockquote>
  <p>File &quot;frozen importlib._bootstrap_external&quot;, line 982, in _recalculate</p>
  </blockquote>
  <blockquote>
  <p>File &quot;frozen importlib._bootstrap_external&quot;, line 978, in _get_parent_path</p>
  </blockquote>
  <blockquote>
  <p>KeyError: 'source'</p>
  </blockquote>