title: How do I get a related Model instance by PK from an ORM Model?
body: <p>I have an SQLAlchemy model class <code>model</code>, a string denoting an attribute/column <code>attr</code> that corresponds to an ORM relationship with another model class <em>othermodel</em>, and a private key or <code>id</code> string of such an <em>othermodel</em>.</p>
  
  <p>I would like to find the object <em>othermodel</em><code>.get(id)</code> to store it in a newly constructed instance, using like <code>setattr(model(), attr, ???)</code> – but I don't have that <em>othermodel</em> accessible in a variable. How do I get that?</p>
  
  <p>I assume I can use some kind of introspection on <code>model</code> or its new instance, but how?</p>