import schedule import time import subprocess import sys import os def run_sendmsg(): script_path = os.path.join(os.path.dirname(__file__), 'sendmsg.py') subprocess.run([sys.executable, script_path]) # 设置每天12点运行 schedule.every().day.at("14:39").do(run_sendmsg) print("定时任务已启动,将在每天12:00运行sendmsg.py") # 保持程序运行 while True: schedule.run_pending() time.sleep(1)