title: python3.x : ModuleNotFoundError when import file from parent directory
body: <p>I am new to Python. This really confused me!  </p>
  
  <p>My directory structure is like this:  </p>
  
  <pre><code>Project
     | - subpackage1
             |- a.py
     | - subpackage2
             |- b.py
     | - c.py  
  </code></pre>
  
  <p>When I import <code>a.py</code> into <code>b.py</code> with <code>from subpackage1 import a</code>, I get a <strong>ModuleNotFoundError</strong>.  It seems like I cannot import a file from the parent directory.  </p>
  
  <p>Some solutions suggest to add an empty file <code>__init__.py</code> in each directory, but that does not work. As a work around, I have put the following in each subfile (i.e., <code>a.py</code> and <code>b.py</code>) to access the parent directory:  </p>
  
  <pre><code>import os
  import sys
  sys.path.append(os.path.abspath('..'))  
  </code></pre>
  
  <p>I have tried to output <code>sys.path</code> in subfiles, it only includes the current file path and anaconda path, so I have to append <code>..</code> to <code>sys.path</code>.  </p>
  
  <p>How can I solve this problem? Is there a more efficient way?</p>