from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.triggers.interval import IntervalTrigger from apscheduler.triggers.cron import CronTrigger import os scheduler = BackgroundScheduler() if bool(os.getenv("BACKGROUND_SCRIPTS_RUN", 0)): print("run") scheduler.start() #example from scripts.example import test_function scheduler.add_job(test_function, trigger=IntervalTrigger(seconds=60)) #end example