python 中的 定时任务 怎么增加job()函数

def job():
    print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
    flag==False

async def run_periodically(interval, periodic_function):
    while True:
        await asyncio.gather(asyncio.sleep(interval), periodic_function())
ib.run(run_periodically(0.1, check_messages))

```python