title: How to import a module from a folder next to the current folder?
body: <p>I have checked as many SO pages as I could and tried everything I found, but none have been successful. I also checked the PEP page regarding importing and tried every example, none of which worked. </p>
  
  <p>I have a tests folder with unit tests in them, and I need to import the module I want to test. The modules are in a folder called 'src' which is next to the src folder.</p>
  
  <p>The folders/files look something like this:</p>
  
  <pre><code>Project / 
          src /
              stringbuilder.py
              __init__.py
          tests / 
              stringbuilder_test.py
              __init__.py
          main.py
          __init__.py
  </code></pre>
  
  <p>I have tried everything I could: adding <code>__init__.py</code> to every folder making it a module including the project's main folder. </p>
  
  <pre><code>import src.module_to_test 
  from ..src.module_to_test import function_to_test
  from ..src import module_to_test
  </code></pre>
  
  <p>I have tested all other combinations all of which have failed. I am starting to think there must be something wrong with either my settings or understanding-- I thought this was suppose to be simple. </p>
  
  <p>If I am making any obvious errors please let me know. </p>
  
  <pre><code>from tests import stringbuilder
  </code></pre>
  
  <p>Error Message:</p>
  
  <pre><code>$ ./stringbuilder_test.py
  Traceback (most recent call last):
    File "./stringbuilder_test.py", line 14, in &lt;module&gt;
      from tests import stringbuilder
  ImportError: No module named tests
  </code></pre>
  
  <p>The same error occurs for (but tests = src):</p>
  
  <pre><code>from src import stringbuilder
  </code></pre>