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__':
 app.run(debug = True)

db.py 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 db.py 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/cli.py", line 236, in locate_app
__import__(module_name)
 File "/home/lietry/sova/callback/bot/__init__.py", line 3, in <module>
 from bot.db import *
 File "/home/lietry/sova/callback/bot/db.py", line 2, in <module>
 from bot import app
ImportError: cannot import name 'app'

So, how to import variables from __init__.py?
March 23rd 20 at 19:44
1 answer
March 23rd 20 at 19:46
Solution
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