title: Flask-migrate does not recognize all modules within a package?
body: <p>I'm new with flask-migrate (and so with Python...) but I'll get to the point.</p>
  <p>I used to store all of my models inside a single <code>models.py</code> file but then I decided to separate every model to its corresponding file.</p>
  <p>After reading this <a href="https://stackoverflow.com/questions/1057431/how-to-load-all-modules-in-a-folder">question</a>. I assumed this would be a quick way for Flask-Migrate (or Alembric) to know all modules within the models package. So I did that way, but once I tried the <code>flask db migrate</code> command, the generated migration file simply dropped a few tables but not all of them.</p>
  <p>Here's the project structure:</p>
  <pre><code>├── app/
  │   ├── __init__.py
  │   └── api/
  │       ├── __init__.py
  │       ├── models/
  │       │   ├── __init__.py
  │       │   ├── model1.py
  │       │   └── model2.py
  │       ├── resources/
  │       └── schemas/
  └── run.py
  </code></pre>
  <p><strong>run.py</strong></p>
  <pre><code>from app import create_app
  
  app = create_app()
  app.run(port=5000)
  </code></pre>
  <p><strong>app/__init__.py</strong></p>
  <pre><code>from flask import Flask
  from flask_migrate import Migrate
  from flask_sqlalchemy import SQLAlchemy
  
  db = SQLAlchemy()
  migrate = Migrate()
  
  def create_app():
      app = Flask(__name__)
  
      db.init_app(app)
      migrate.init_app(app, db)
  
      # importing the models...
      from .api import models # this should work?
      # ... or do I have to manually write every single module?
  
      return app
  </code></pre>
  <p><strong>app/api/models/__init__.py</strong></p>
  <pre><code>from os.path import dirname, basename, isfile, join
  import glob
  
  # Trying to apply what I learned from the referenced question...
  modules = glob.glob(join(dirname(__file__), &quot;*.py&quot;))
  __all__ = [
      basename(f)[:-3] for f in modules if isfile(f) and not f.endswith(&quot;__init__.py&quot;)
  ]
  </code></pre>
  <p><strong>Model files in app/api/models/</strong></p>
  <pre><code>from app import db
  
  class ExampleModel(db.Model):
      # Model declarations goes here...
      pass
  </code></pre>
  <p>So... to summarize this question, <strong>is there a better way to do this or I should import every single module in the <code>app/__init__.py</code> file?</strong></p>