title: how can I solve this circular dependent imports in order to execute many to one insert
body: <p>I have the following two models in several files:</p>
  <p><strong>routes/camera/model.py</strong></p>
  <pre><code>from services.db import db
  from dataclasses import dataclass
  from routes.project.models import Project
  
  @dataclass
  class Camera(db.Model):
      __tablename__ = 'cameras'
      id: int
      name: str
      project_id: int
      url: str
  
      id = db.Column(db.Integer, primary_key=True)
      name = db.Column(db.String(80), unique=True, nullable=False)
      url = db.Column(db.String(1000), unique=True, nullable=False)
      project_id = db.Column(db.Integer, db.ForeignKey('projects.id'), nullable=False)
      
  db.create_all()
  </code></pre>
  <p><strong>routes/project/model.py</strong></p>
  <pre><code>from services.db import db
  from dataclasses import dataclass
  from routes.camera.models import Camera
  
  @dataclass
  class Project(db.Model):
      __tablename__ = 'projects'
      id: int
      name: str
  
      id = db.Column(db.Integer, primary_key=True)
      name = db.Column(db.String(80), unique=True, nullable=False)
      cameras = db.relationship(Camera, backref='projects')
      
  db.create_all()
  </code></pre>
  <p>The problem is that I need make a insert by project name in camera in order to do this I have the following approach:</p>
  <pre><code>def create_camera(name: str, url:str, project_name:str):
      project = Project(name=project_name)
      camera = Camera(name=name, project_id=project, url=url)
      db.session.add(camera)
      db.session.commit()
  </code></pre>
  <p>but I get  a circular dependant and I cannot make this insert</p>
  <p>So, how can I solve this problem (circular dependent import) or the insert in order to avoid to instantiate the Project class?</p>
  <p>Thanks</p>