The problem of module error reporting under different paths imported under PyCharm-- project
When using PyCharm, we often encounter py scripts written by import itself, which prompt that the module is not located, resulting in import failure.
Let's look at an example:
Directory structure:
-the code actually written
-Interface
-* * _ check.py
Test_***_all_copy.py
We need to import the sibling directory under the folder interface in the test_***_all_copy.py script.
* * _ check.py all the classes and functions contained in the py file.
The following words are incorrect:
If you directly import all the files under * * _ check, an error will be reported.
All the py files in this import folder, which is written incorrectly, will prompt that the relevant class or function cannot be found under * _ check.
This kind of writing directly to the top-level directory of project is sometimes successful. But I failed this time, so you can use it according to the situation.
The following import method is correct, which is directly followed by the py file * check from the interface of the same level directory.
Import all under Interface.***_check.