DEV Community

Sivaram Rasathurai
Sivaram Rasathurai

Posted on

Answer: What is the best way to repeatedly execute a function every x seconds? [closed]

Alternative flexibility solution is Apscheduler.

pip install apscheduler
from apscheduler.schedulers.background import BlockingScheduler
def print_t()
  pass

sched = BlockingScheduler()
sched.add_job(print_t, 'interval', seconds =60) #will do the print_t work for every 60 seconds

sched.start()

Also, apscheduler provides so many schedulers as follow.

  • BlockingScheduler: use when the scheduler is the only thing…

Top comments (0)