title: SQLAlchemy import tables with relationships
body: <p>I have problem with separating tables with relationships in different files. I want the tables below to be in three separate files and to import <strong>TableA</strong> in third party page, but I can not manage the load order. </p>
  
  <p>In most of the time I'm receiving the following error. </p>
  
  <p><strong>sqlalchemy.exc.</strong> <em>InvalidRequestError: When initializing mapper Mapper|TableA|tablea, expression 'TableB' failed to locate a name ("name 'TableB' is not defined"). If this is a class
  name, consider adding this relationship() to the  class after both dependent classes have been defined.</em></p>
  
  <pre><code>class TableA(Base):
      __tablename__ = "tablea"
     id = Column(Integer, primary_key=True)
     name = Column(String)
  
     tableB = relationship("TableB", secondary = TableC.__table__)
  
  class TableB(Base):
     __tablename__ = "tableb"
     id = Column(Integer, primary_key=True)
    name = Column(String)
  
  class TableC(Base):
     __tablename__ = "tableab"
     tableAId = Column("table_a_id", Integer, ForeignKey("TableA.id"), primary_key=True)
     tableBId = Column("table_b_id", Integer, ForeignKey("TableB.id"), primary_key=True)
  </code></pre>