1、 If the name of the module is the package name created by yourself, as shown in the picture:
1. Add the following code at the top of the file to be run, and the content in quotation marks is the project path:
import sys
sys.path.append(r"C:\Users\Administrator\XXXProjects\XXX")
Note: be sure to write it before all the codes introduced into the module, for example:
2. Add two lines of code in 1 to all imported files, such as runmethod and get in the above figure_ Data and other files need to be added
3. Another method: create a new file base.py, add the following code, and import it before the codes of all imported modules:
import sys
import os
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.abspath(os.path.dirname(curPath) + os.path.sep + ".")
sys.path.append(rootPath)
2、 If the module name is a python module, you need to reinstall it, that is, enter the command PIP install XXX in CMD