title: Which is the correct way of handling imports in complex Python project?
body: <p>I have always used Python for single-file scripts and now I am working on my first "complex" project, so I have not experience with packages in Python (3.x).</p>
  
  <p>I know this is a frequently asked question, but I am missing something for successfully organizing module imports in my project, which should be used as a library.</p>
  
  <p>Assuming following project tree:</p>
  
  <pre><code>myProject/
  - subpackage1/
     - __init__.py
     - other1.py
  - subpackage2/
     - __init__.py
     - other2.py
  - __init__.py
  - foo.py
  - bar.py
  </code></pre>
  
  <p><strong>Which is the correct way of importing modules from each other?</strong> In particular:</p>
  
  <ol>
  <li>importing <code>foo</code> from <code>bar</code></li>
  <li>importing <code>foo</code> from <code>other1</code></li>
  <li>importing <code>other1</code> from <code>other2</code></li>
  <li>importing <code>foo</code> (which is a library) from a different directory during development (are virtual environments the right choice?)</li>
  </ol>
  
  <p>Thanks!</p>
  
  <p>EDIT: (to make the question more specific) I obviously tried different approaches before asking. What I saw in some popular projects is using absolute imports like <code>from myProject.subpackage1.other1 import something</code>. It looks like a clean solution (similar to what I'm used to do in Java), but when adopting this approach I can't simply run my code due to import errors. Could <code>virtualenv</code> be a solution to install the packages before trying to import them?</p>