The program can run in the development environment, but the command line will not work. The project directory is shown in the figure:
codes_no_useful_local is the project directory, A and B are two folders, there is a script test.py in the A directory, and a script func.py in the B directory. The code in test.py is to call the function in func.py, but it needs to be added The above and below codes can be executed through the command line, otherwise, the imported package cannot be found.
import sys
import os
project = 'codes_no_useful_local'
sys.path.append(os.getcwd().split(project)[0]+project)
from B import func
func.b_func()