title: How to import a module from a different folder?
body: <p>I have a project which I want to structure like this:</p>
  <pre><code>myproject
  ├── api
  │   ├── __init__.py
  │   └── api.py
  ├── backend
  │   ├── __init__.py
  │   └── backend.py
  ├── models
  │   ├── __init__.py
  │   └── some_model.py
  └── __init__.py
  </code></pre>
  <p>Now, I want to import the module <code>some_model.py</code> in both <code>api.py</code> and <code>backend.py</code>. How do I properly do this?</p>
  <p>I tried:</p>
  <pre><code>from models import some_model
  </code></pre>
  <p>but that fails with <code>ModuleNotFoundError: No module named 'models'</code>.</p>
  <p>I also tried:</p>
  <pre><code>from ..models import some_model
  </code></pre>
  <p>which gave me <code>ValueError: attempted relative import beyond top-level package</code>.</p>
  <p>What am I doing wrong here? How can I import a file from a different directory, which is not a subdirectory?</p>