atm---main.py import os ,sys print(__file__) print(os.path.abspath(__file__))#绝对路径 print(os.path.dirname(os.path.abspath(__file__))) #相对路径 bash=os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(bash) from config import settings settings.sayhi() config--settings.py def sayhi(): print('hello')