title: Circular imports in python3
body: <p>I have a package which contain several files. Each file contains a class and the classes are interdependant. How can I avoid circular dependencies without putting all the code in one file. Is there a better way to refactor the code or is there a way to resolve the circular imports</p>
  
  <p>This is the directory structure</p>
  
  <pre><code>.
  |-- Complainant.py
  |-- Complaint.py
  `-- __init__.py
  </code></pre>
  
  <p>Complaint.py:</p>
  
  <pre><code>from .Complainant import Complainant
  
  class Complaint(BaseDocument):
      ALL_STATUS = ["waiting","resolved", "rejected"]
      text = TextField()
      timestamp = DateTimeField()
      status = TextField()
      complainant_id = TextField()
      department_ids = ListField(TextField())
  
      def get_complainant(self):
          db = DBManager.db()
          complainant = Complainant.load(db, self.complainant_id)
          return complainant
  </code></pre>
  
  <p>Complainant.py</p>
  
  <pre><code>from .Complaint import Complaint
  
  class Complainant(BaseDocument):
      account_type = TextField()
      account_handle = TextField()
      complaint_ids = ListField(TextField())
  
      def get_complaints(self):
          db = DBManager.db()
          complaints = [Complaint.load(db, i) for i in self.complaint_ids]
          return complaints
  </code></pre>
  
  <p><strong>init</strong>.py</p>
  
  <pre><code>from .Complaint import Complaint
  from .Complainant import Complainant
  
  __all__ = [
      Complaint,
      Complainant
  ]
  </code></pre>