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
if event.type == VkBotEventType.MESSAGE_NEW and event.object.message['action']['type'] == "chat_invite_user":
id = event.object.message['action']['member_id']
get_user = vk.users.get(user_ids=id)
vk.messages.send(peer_id=event.object.message['peer_id'], random_id=0, message=f"[id{id}|{get_user[0]['first_name']} {get_user[0]['last_name']}], привет")