title: flask run giving me ModuleNotFoundError
body: <p>I'm relatively new to python and am trying to build a flask server. What I would like to do is have a package called &quot;endpoints&quot; that has a list of modules where each module defines a subset of application routes. When I make a file called server.py with the following code this works like so</p>
  <pre><code>import os
  
  from flask import Flask
  
  
  app = Flask(__name__)
  
  from endpoint import *
  
  if __name__ == '__main__':
      app.run(debug=True, use_reloader=True)
  </code></pre>
  <p>Right now there's only one endpoint module called hello.py and it looks like this</p>
  <pre><code>from __main__ import app
  
  
  # a simple page that says hello
  # @app.route defines the url off of the BASE url e.g. www.appname.com/api + 
  #    @app.route
  # in dev this will be literally http://localhost:5000/hello
  @app.route('/hello')
  def hello():
      return 'Hello, World!'
  </code></pre>
  <p>So... the above works when I run python server.py, the issue happens when I try to run the app using flask.</p>
  <p>Instead of server.py it just calls <code>__init__.py</code> which looks like this</p>
  <pre><code>import os
  
  from flask import Flask
  
  # create and configure the app
  # instance_relative_config states that the 
  #     config files are relative to the instance folder
  app = Flask(__name__, instance_relative_config=True)
  
  # ensure the instance folder exists
  try:
      os.makedirs(app.instance_path)
  except OSError:
      pass
  
  from endpoint import *
  </code></pre>
  <p>When I run <code>flask run</code> in terminal I get <code>ModuleNotFoundError: No module named 'endpoint'</code></p>
  <p>but again if I change the code so it looks like the following below, then <code>flask run</code> works.</p>
  <pre><code>import os
  
  from flask import Flask
  
  # create and configure the app
  # instance_relative_config states that the 
  #     config files are relative to the instance folder
  app = Flask(__name__, instance_relative_config=True)
  
  # ensure the instance folder exists
  try:
      os.makedirs(app.instance_path)
  except OSError:
      pass
  
  # a simple page that says hello
  # @app.route defines the url off of the BASE url e.g. www.appname.com/api + 
  #   @app.route
  # in dev this will be literally http://localhost:5000/hello
  @app.route('/hello')
  def hello():
      return 'Hello, World!'
  </code></pre>
  <p>I'm pretty sure this is happening because I don't fully understand how imports work...</p>
  <p>So, how do I set up <code>__init__.py</code> so that it imports all the modules from the &quot;endpoint&quot; package and works when I call <code>flask run</code>?</p>