import schedule,time def job(): print('Running task') schedule.every(5).seconds.do(job) while True: schedule.run_pending() time.sleep(1)