title: In Python 3 (under Pydev) how to correctly write imports within packages
body: <p>Similar questions have been asked a number of times, but none of the suggested solutions work (satisfactory) in my case.</p>
  
  <p>I have a Python 3 project with a structure like so:</p>
  
  <pre><code>├── project1
  │   ├── package
  │   │   ├── tests
  │   │   │   ├── __init__.py
  │   │   │   └── test1.py
  │   │   ├── __init__.py
  │   │   ├── module1.py
  │   │   └── module2.py
  │   └── setup.py
  </code></pre>
  
  <p>I have <code>package</code> listed as source folder in <code>PYTHONPATH</code> (in Eclipse).</p>
  
  <p>Everything works fine inside the project, i.e.:</p>
  
  <ul>
  <li>In <code>tests\test1.py</code> doing <code>import module1</code> <strong>works</strong></li>
  <li>In <code>module2.py</code> both <code>from module1 import foo</code> or simply <code>import module1</code> <strong>work</strong></li>
  </ul>
  
  <p><strong>However</strong>, when I package my code and install it using <code>pip</code> I start getting <code>ImportError</code>.</p>
  
  <p>If in <code>project2</code> I try to <code>import module2</code> or <code>from module2 import foo</code> I get an error on the import that <code>module2</code> does from <code>module1</code>.
  For the imports in <code>project2</code> to work I need to change the import in <code>module2</code> to be <code>from package.module1 import foo</code> or <code>import package.module2</code>. This makes <code>project1</code> to throw import errors.
  There are similar problems with <code>test1.py</code>.</p>
  
  <p>I can in Eclipse add the folder of <code>project1</code> to <code>PYTHONPATH</code> and that solves the <strong>runtime</strong> error, but I still see compilation errors in PyDev.</p>
  
  <p>Is there any way to write the imports or define the PYTHONPATH so Python 3 will find the imported modules/methods in all cases?
  I am emphasizing Python 3 because I have a project with the same structure (as far as I can tell) under Python 2 which works well with the imports defined as <code>import .module1</code> (this throws an error for Python 3)</p>