title: Circular import in marshmallow
body: <p>I have two objects that are related to one another.  I'd like to be able to access one object through the other by going through the related attribute.</p>
  
  <p>E.g. <code>A.b_relationship.obj.some_property</code></p>
  
  <p>How can I do this without creating a circular import?</p>
  
  <pre><code># lib.py
  class Relationship(object):
  
      def __init__(self, obj):
          self.obj = obj
  
  
  # a.py
  class A(object):
      b_relationship = Relationship(B)
  
  # b.py
  class B(object):
      a_relationship = Relationship(A)
  </code></pre>
  
  <hr>
  
  <p>For clarity, I've added this additional example.  Obviously SQLAlchemy has solved this issue with the <code>backref</code> attribute.  I'm not sure how feasible it would be for me to implement this sort of thing into marshmallow without breaking the way it works.  Perhaps I need to change my mindset?</p>
  
  <pre><code>from marshmallow import Schema
  from marshmallow.fields import String
  
  from project.database import db
  
  
  class PersonModel(db.Model):
      name = db.Column(db.String)
  
  
  class PetModel(db.Model):
      name = db.Column(db.String)
      owner = db.relationship('PersonModel', backref='pets')
  
  
  class PersonSchema(Schema):
      name = fields.String(init_arg='some value')
      pets = fields.Relationship(related_schema=PetSchema)
  
  
  class PetSchema(Schema):
      name = fields.String()
      owner = fields.Relationship(related_schema=PersonSchema)
  </code></pre>