from threading import Thread
from apscheduler.schedulers.asyncio import AsyncIOScheduler
async def test():
#code
def run():
scheduler = AsyncIOScheduler()
scheduler.add_job(test, 'interval', seconds=3)
scheduler.start()
thread = Thread(target=run())
thread.start()
#code
from threading import Thread
from apscheduler.schedulers.asyncio import AsyncIOScheduler
async def test():
#code
def run():
scheduler = AsyncIOScheduler()
scheduler.add_job(test, 'cron', hour=3, minute=0)
scheduler.start()
thread = Thread(target=run())
thread.start()
#code