Python Import Error: SystemError: Parent module ‘‘ not loaded, cannot perform relative import

System error: parent module “not loaded, can not perform relative import when importing Python package

When using flash for web development, the structure of the project is reset as follows:
write the picture description here
when running the project again, the system error: parent module “not loaded, cannot perform relative import will appear. Through the error location, it is found that the problem is caused by the packet guidance.

from .app import create_ app

The “parent module” is not loaded and cannot be imported. Why is there such a problem
by viewing the project structure, use

from web_ flask.app import create_ app

At this time, there are more package guiding problems
write the picture description here
first locate yourself in views.py and delete the package guiding statement

from .models import Users

Then, use the local guide
from web_ Flash. App. Models import users
User = users (1 ‘sun’)
so far, the problem has been solved
or you can add the corresponding Python path with sys.path.append
to solve the problem———————


Read More: