1 | initial version |
Assuming the asynchronous function is saved in a dictionary as a value with a specific key, you can call it using the await
keyword followed by the dictionary key and function call. Here is an example:
async def my_async_func():
# some async code here
return result
async_func_dict = {'async_func_key': my_async_func}
# calling the async function
result = await async_func_dict['async_func_key']()
In this example, my_async_func()
is an asynchronous function that returns a result. It is saved in a dictionary async_func_dict
with the key async_func_key
. To call this function, we use the await
keyword followed by async_func_dict['async_func_key']()
. This will execute the function and return the result, which we can assign to a variable.