title: Python import error- No Module named error
body: <p>I am trying to import one python file in another. I have the following directory structure -</p>
  
  <pre class="lang-none prettyprint-override"><code>/a/program.py
  /b/python_package/test.py
  /b/python_package/__init__.py
  </code></pre>
  
  <p>Program. py- </p>
  
  <pre><code>import sys
  sys.path.append('/b/python_package')
  import test
  </code></pre>
  
  <p>also tried </p>
  
  <pre><code>from python_package import test
  </code></pre>
  
  <p>Test.py-</p>
  
  <pre><code>print('imported package')
  </code></pre>
  
  <p>I am getting no module named test error.</p>
  
  <pre class="lang-none prettyprint-override"><code>ImportError: No module named test in &lt;script&gt; at line number 5
  </code></pre>
  
  <pre><code>
  Traceback (most recent call last):
    File "&lt;script&gt;", line 7, in &lt;module&gt;
  ImportError: No module named test
  None
  </code></pre>
  
  <p>What am I doing wrong?</p>