I have the following app structure. IDE works fine, resolves, but running some scripts gives me
File "/home/sink/TARET/app/models.py", line 4, in <module> from app import db ImportError: No module named app error. I call the module as:
import datetime from app import db class Role(db.Model): __tablename__ = 'role' RoleID = db.Column(db.Integer, primary_key=True) Name = db.Column(db.String(80), unique=True) ModifiedDate = db.Column(db.DATETIME) and so on What is the correct usage of modules in python? I have the following structure.

Ok edit:
db is defined in init.py as
app = Flask(__name__) app.debug = True app.config.from_object('config') db = SQLAlchemy(app)
dbdefined? and ifappis a module, where is the__init__.pyto define it as a module? In a nutshell: your IDE is wrong, python is right: app does not exists, db even less.