title: Flask error when trying to import a model
body: <p>I'm trying to create a user through terminal, but I got this message:</p>
  <p>(I've already take a look on SQLAlchemy's documentation. I had no problems creating the User class and starting the db at the same file, but I'm not finding where is my problem when I work with different files)</p>
  <pre><code>&gt;&gt;&gt; test = User('a', 'b', 'c')
  
  Traceback (most recent call last):
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  NameError: name 'User' is not defined
  </code></pre>
  <p>My directory tree:</p>
  <pre><code>+-- __init__.py
  +-- models
  |   +-- tables.py
  </code></pre>
  <p>My <strong>init</strong>.py file:</p>
  <pre><code>from flask import Flask
  from flask_script import Manager
  from flask_sqlalchemy import SQLAlchemy
  
  app = Flask(__name__)
  app.config.from_object('config')
  
  db = SQLAlchemy(app)
  
  manager = Manager(app)
  
  from app.models import tables
  from app.controllers import default
  </code></pre>
  <p>My tables.py (The file where I creted the User model):</p>
  <pre><code>from app import db
  from flask_login import UserMixin
  
  
  class User(UserMixin, db.Model):
      id = db.Column(db.Integer, primary_key=True)
      name = db.Column(db.String(50))
      username = db.Column(db.String(30), unique=True)
      password = db.Column(db.String(30))
  
      def __repr__(self):
          return '&lt;User %r&gt;' % self.username
  
      def __init__(self, name, username, password):
          self.name = name
          self.username = username
          self.password = password
  </code></pre>