In a. Py file in directory a, the b. Py file of import directory b:
sys.path.append('path to b.py')import b
Sometimes you need to use the same directory in the same directory as b. Py, for example.
The relative path '. 'is the directory where the py is located, or the directory where the script is invoked. To get the absolute path to the b. Py, you can use.
It's more complex to include a. Py in the import parent directory involving the previous relationship. In general, the cd to the lowest layer calls the script