title: SQLAlchemy Model Circular Import
body: <p>I have two models in the same module named <code>models</code>.  They are a 1-1 relationship and have been configured per the <a href="http://docs.sqlalchemy.org/en/latest/orm/basic_relationships.html#one-to-one" rel="noreferrer">SQLAlchemy docs</a>. </p>
  
  <p><strong>Vehicle.py</strong></p>
  
  <pre><code>from models.AssetSetting import AssetSetting
  
  class Vehicle(Base):
       __tablename__ = 'vehicles'
  
       vehicle_id = Column(Integer, primary_key=True)
       ...
       settings = relationship('AssetSetting', backref=backref('asset_settings'))
  </code></pre>
  
  <p><strong>AssetSetting.py</strong></p>
  
  <pre><code>from models.Vehicle import Vehicle
  
  class AssetSetting(Base):
       __tablename__ = 'asset_settings'
  
       asset_alert_setting_id = Column(Integer, primary_key=True, autoincrement=True)
       ...
  
       vehicle = relationship('vehicles', foreign_keys=Column(ForeignKey('vehicles.vehicle_id')))
  </code></pre>
  
  <p>If I use the string relationship building (i.e. <code>ForeignKey('vehicles.vehicle_id')</code>) I get the error:</p>
  
  <pre><code>sqlalchemy.exc.InvalidRequestError: 
  When initializing mapper Mapper|AssetSetting|asset_settings, expression 'vehicles' failed to locate a name ("name 'vehicles' is not defined"). 
  If this is a class name, consider adding this relationship() to the &lt;class 'models.AssetSetting.AssetSetting'&gt; class after both dependent classes have been defined.
  </code></pre>
  
  <p>If I use the class mapping, I get the classic circular import error:</p>
  
  <pre><code>Traceback (most recent call last):
  File "tracking_data_runner.py", line 7, in &lt;module&gt;
  from models.Tracker import Tracker
  File "/.../models/Tracker.py", line 5, in &lt;module&gt;
  from models.Vehicle import Vehicle
  File "/.../models/Vehicle.py", line 13, in &lt;module&gt;
  from models.Tracker import Tracker
  ImportError: cannot import name 'Tracker'
  </code></pre>
  
  <p>I believe I could fix this issue by putting the files in the same package but would prefer to keep them separate.  Thoughts?</p>