title: Why `from . import views` can solve circle import in Flask?
body: <p>I learn from <a href="http://flask.pocoo.org/docs/0.10/patterns/packages/" rel="nofollow">Larger Applications</a>.In this document, It says: "all the view functions (the ones with a route() decorator on top) have to be imported in the <strong>init</strong>.py file. <strong>Not the object itself, but the module it is in.</strong>"<br>
  I don't know why should when I do this: <code>from . import views</code>,It succeed.Though <code>from views import *</code> can also work well.<br>
  I organize these file like this:</p>
  
  <pre><code>myapplication/
    runner.py
    myflask/
      __init__.py
      views.py
      templates/
      static/
      ...
  </code></pre>
  
  <p>runner.py:</p>
  
  <pre><code>from testFlask import app
  app.run()
  </code></pre>
  
  <p>myflask/__init__.py:</p>
  
  <pre><code>from flask import Flask
  app = Flask(__name__)
  from . import views # why this can work????
  </code></pre>
  
  <p>myflask/views.py:</p>
  
  <pre><code>from . import app
  @app.route('/')
  def index():
      return 'Hello World!'
  </code></pre>
  
  <p>and I run it:</p>
  
  <pre><code>$ cd myapplication
  $ python runner.py
  </code></pre>
  
  <p>It's OK to run this Flask app. However I want to know why <code>from . import views</code> can solve this <strong>circle import</strong> problem in flask? And why the doc says: <strong>Not the object itself, but the module it is in</strong>????</p>
  
  <p>However,when I do like this:</p>
  
  <pre><code>#some_dir/
  #  application.py
  #  views.py
  
  #application.py
  from flask import Flask
  app = Flask(__name__)
  import views # it doesn't work
  # from views import * # it works
  app.run()
  
  #views.py
  from application import app
  @app.route('/')
  def index():
      return 'Hello World!'
  
  #run it
  $ python application.py
  </code></pre>
  
  <p>It doesn't work.</p>