Is it possible to run a function detached from the main loop?
the reason for this is that I have the one function that runs every time a message is sent and if I operate a command from it, it holds until that command is done before exiting the function and allowing a new message to enter. so I need to detach it from the main loop and let it runs on its own until it's done.
I tried running it asynchronously with
loop.create_task(run_command(input))
but it still waits for the command to finish before exiting the containing function, not allowing input during that time.
here is a basic example
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith(Config.prefix):
loop = asyncio.get_event_loop()
if command in commands.List:
loop.create_task(getattr(commands, command)().call(message))