 <p>The error occurs because when the class body executes the Bid class object has not yet been created.</p> <p>You cannot have a model class contain a substructure of the same class -- it would result in infinite space. A StructuredProperty <em>physically</em> includes the fields of another model in the current model.</p> <p>So I recommend deleting the StructuredProperty line.</p> <p>You will then get a similar error on the KeyProperty line, but for KeyProperty it can be fixed by using a string ('Bid') instead of a direct class reference (Bid).</p> <p>You'll have to use outbyd_by_key.get() to access the bid's contents.</p>