title: Python, unable to import
body: <p>I've asked a similar question <a href="https://stackoverflow.com/questions/54056892/flask-importerror/54059124">before</a> and without having found a solution I've simplified my code as much as possible to illustrate the problem.</p>
  
  <p>The code below runs fine, until I include <code>from run import db</code> in <code>models.py</code>. Then I get <code>ImportError: cannot import name 'Site'</code> (full error below)</p>
  
  <p>However when I use <code>from models import *</code> then everything runs fine again (but I don't want to do that).</p>
  
  <p>Why does this happen? </p>
  
  <p><strong>run.py</strong></p>
  
  <pre><code>from flask import Flask
  from flask_sqlalchemy import SQLAlchemy
  
  app = Flask(__name__)
  app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///database/db.db"
  app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
  db = SQLAlchemy()
  
  from models import Site
  # from models import *
  print (Site.hello())
  </code></pre>
  
  <p><strong>models.py</strong></p>
  
  <pre><code># Uncommenting the import line below produces the error
  # from run import db
  
  class Site():
  
      def hello():
          print ("hello world")
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <pre><code>    (venv) abc:projectx me$ python run.py
  Traceback (most recent call last):
    File "run.py", line 16, in &lt;module&gt;
      from models import Site
    File "/Users/me/projectx/models.py", line 1, in &lt;module&gt;
      from run import db
    File "/Users/me/projectx/run.py", line 16, in &lt;module&gt;
      from models import Site
  ImportError: cannot import name 'Site'
  </code></pre>
  
  <p>Directory structure</p>
  
  <pre><code>projectx
      __pycache__
      database
      venv
      __init__.py
      run.py
      models.py
  </code></pre>