How to use database models in Python Flask?

Solution
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
def init_app(app):
    db.init_app(app)
import database
...
database.init_app(app)
from database import db
...