As shown below:
Unresolved reference 'ERROR_CODE_INPUT_ERROR' less... (Ctrl+F1) This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.
Description of the problem
Pycharm shows that these classes cannot be referenced, and even if they are in the project, a look at the import at the top of the file will show that the corresponding module import was unsuccessful.
analyze
Since these classes are in the project, the import doesn't work because the paths don't correspond. The fact is that pycharm defaults the root directory of the project to the source directory, so if the import uses an absolute path instead of a relative path, it will look up the root directory of the project instead of the /src directory in which we'd like it to be, and so the import doesn't work.
cure
Change to relative path
from ...package import *
The first . indicates the current directory, and each subsequent '.' indicates the previous directory. Using relative directories guarantees the success of the import, but it is not recommended, because if you want to move the current file to another package, you will have to change a lot of places, of course, using relative paths means that you can change the name of the package as you like, as long as you make sure the
Setting the source path in pycharm
file–>setting–>project:server–>project structure
Set the folder where the package is placed to source, so that the imported module classes, etc., are found by using these source folders as the root path, i.e., the imported stuff is found in these source folders.
Above this perfect solution to the problem of Pycharm can not import packages Unresolved reference is all that I have shared with you, I hope to give you a reference, and I hope that you will support me more.