import os if __name__ == '__main__': script_path = os.path.join(os.path.dirname(__file__), 'app', 'main.py') # 使用exec函数执行脚本 with open(script_path, 'r') as file: exec(file.read())