title: AttributeError: module 'flask.app' has no attribute 'route'
body: <p>I have <code>autocomplete</code> function as a separate file - autocomplete.py. The autocomplete is being imported into <strong>init</strong>.py as follows:</p>
  
  <pre><code>from xyzapp.autocomplete import autocomplete
  </code></pre>
  
  <p>The line that throws error in autocomplete.py is the following:</p>
  
  <pre><code>@app.route('/autocomplete',methods=['GET'])
  </code></pre>
  
  <p>The structure of the application is using blueprints and looks as follows:</p>
  
  <pre><code>appcontainer
       |
       |--run.py
       |      
       |
       |--xyzapp
            |--__init__.py
            |--autocomplete.py
            |--blueprint_folder_1
            |--blueprint_folder_2
            |--static
  </code></pre>
  
  <p>The whole error message looks like this:</p>
  
  <pre><code> @app.route('/autocomplete',methods=['GET'])
   AttributeError: module 'flask.app' has no attribute 'route' 
  </code></pre>
  
  <p>Any ideas what I am doing wrong?   </p>
  
  <p>UPDATE:</p>
  
  <p>The autocomplete.py looks as follows:</p>
  
  <pre><code>from flask import Flask, render_template, redirect, url_for, request, session, flash, app, Blueprint, jsonify
  
  @app.route('/autocomplete',methods=['GET'])
  def autocomplete():
      database='backbone_test'
      db=client[database]
      all_names=list(db.ids.find({},{"current_name":1,"_id":0}))
      return json.dumps(all_names) 
  </code></pre>
  
  <p>The <code>__init__.py</code> file looks as follows:</p>
  
  <pre><code>from flask import Flask, render_template, Blueprint, jsonify, session
  import jinja2
  
  class MyApp(Flask):
    def __init__(self):
      Flask.__init__(self, __name__)
      self.jinja_loader = jinja2.ChoiceLoader([self.jinja_loader,jinja2.PrefixLoader({}, delimiter = ".")])
      def create_global_jinja_loader(self):
          return self.jinja_loader
  
      def register_blueprint(self, bp):
          Flask.register_blueprint(self, bp)
          self.jinja_loader.loaders[1].mapping[bp.name] = bp.jinja_loader
  
  app = MyApp()
  
  from xyzapp.autocomplete import autocomplete
  from xyzapp.blueprint_folder_1.some_file import bp_1
  
  app.register_blueprint(bp_1)
  </code></pre>