title: Flask-SqlAlchemy Error with ForeignKey for Tables in different Models.py files
body: <p>I'm trying to create two tables, each from a different models.py file. There is a a foreign key link between the two tables.</p>
  
  <p>I can get it to work correctly when the two classes below are in the same models.py file. However, when I put them in separate files I receive an errors.</p>
  
  <p>How do I adapt this to so it works as expected? I can only find 1-to-many relationship examples where the tables in the same file.</p>
  
  <p>Table 1 Code:</p>
  
  <pre><code>class Person(db.Model):
      __tablename__ = "Person"
      __table_args__ = {'schema': 'example'}
      id = db.Column(db.Integer, primary_key=True)
      name = db.Column(db.String(50))
      addresses = db.relationship('Address', backref='person',
                                  lazy='dynamic')
  </code></pre>
  
  <p>Table 2 Code:</p>
  
  <pre><code>class Address(db.Model):
      __tablename__ = "Address"
      __table_args__ = {'schema': 'example'}
      id = db.Column(db.Integer, primary_key=True)
      email = db.Column(db.String(50))
      person_id = db.Column(db.Integer, db.ForeignKey('example.Person.id'))
  </code></pre>
  
  <p>Error:</p>
  
  <p><code>sqlalchemy.exc.NoReferencedTableError: Foreign key associated with column 'Address.person_id' could not find table 'example.Person' with which to generate a foreign key to target column 'id'</code></p>
  
  <p>Many thanks</p>