title: lask.cli.NoAppException: While importing "app", an ImportError was raised:
body: <p>1.I'm trying to build a flask project and try to import the class into models.py and import routes into app.py. When I was trying to run the project, it showed some errors. Here is the information for traceback:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/Users/cheliang/Desktop/project/env/lib/python3.8/site-packages/flask/cli.py&quot;, line 240, in locate_app
      __import__(module_name)
    File &quot;/Users/cheliang/Desktop/project/app.py&quot;, line 4, in &lt;module&gt;
      from user import routes
    File &quot;/Users/cheliang/Desktop/project/user/routes.py&quot;, line 1, in &lt;module&gt;
      from user.models import User
  ImportError: cannot import name 'User' from 'user.models' (/Users/cheliang/Desktop/project/user/models.py)
  </code></pre>
  <p>The tree structure for my project:</p>
  <pre><code>├── app.py
  ├── env
  ── run
  ├── static
  │   ├── css
  │   │   ├── normalize.css
  │   │   └── styles.css
  │   └── js
  │       ├── jquery.js
  │       └── scripts.js
  ├── templates
  │   ├── base.html
  │   ├── dashboard.html
  │   └── home.html
  └── user
      ├── __init__.py
      ├── __pycache__
      │   ├── __init__.cpython-38.pyc
      │   ├── models.cpython-38.pyc
      │   └── routes.cpython-38.pyc
      ├── models.py
      └── routes.py
  </code></pre>
  <p>2.Here is the code details:
  <strong>models.py:</strong></p>
  <pre><code>from flask import Flask, jsonify
  class User:
      def signup(self):
  
          user = {
           &quot;_id&quot;:&quot;&quot;,
  
           &quot;name&quot;:&quot;&quot;,
           &quot;email&quot;:&quot;&quot;,
           &quot;password&quot;:&quot;&quot;
  
          }
          return jsonify(user),200
  </code></pre>
  <p>Here is the routes.py:</p>
  <pre><code>from user.models import User
  from flask import Flask
  from app import app 
  
  @app.route('/user',methods=[&quot;GET&quot;])
  def signup(self):
      return User().signup()
  </code></pre>
  <p>Here is the code for app.py</p>
  <pre><code>from flask import Flask ,render_template
  
  app = Flask(__name__)
  from user import routes
  
  @app.route('/')
  def home():
      return render_template('home.html')
  
  @app.route('/dashboard')
  def dashboard():
      return render_template('dashboard.html')
  </code></pre>