Is not imported variable python flask?

Good day, there was a problem, I have created a package, in __init__ wrote
import telebot
from flask import Flask, session
from bot.db import *

app = Flask(__name__)
app.secret_key = 'ddddd'

if __name__ == '__main__': = True) looks like this
from flaskext.mysql import MySQL
from bot import app

app.config['MYSQL_DATABASE_USER'] = 'lie'
app.config['MYSQL_DATABASE_PASSWORD'] = 'zx23ww'
app.config['MYSQL_DATABASE_DB'] = 'telebot'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'

mysql = MySQL(app)
connect = mysql.connect()

And there was a problem in I can not import variable app
* Serving Flask app "bot"
 * Environment: production
 WARNING: This is a development server. Do not use it in a production deployment.
 Use a production WSGI server instead.
 * Debug mode: off
Usage: flask run [OPTIONS]

Error: While importing "bot", an ImportError was raised:

Traceback (most recent call last):
 File "/home/lietry/sova/callback/venv/lib/python3.6/site-packages/flask/", line 236, in locate_app
 File "/home/lietry/sova/callback/bot/", line 3, in <module>
 from bot.db import *
 File "/home/lietry/sova/callback/bot/", line 2, in <module>
 from bot import app
ImportError: cannot import name 'app'

So, how to import variables from
March 23rd 20 at 19:44
1 answer
March 23rd 20 at 19:46
You from bot import db and db - bot. Rosimport can't do that. Either import one or all variables for sharing take out in a separate package

Find more questions by tags FlaskPython