How to use async function in python

You are here:
< Back

Following example shows that when function A() is executed, function B() is also executed!

def functionA():
    db.session.query(example_code)
    functionB()
    
def functionB():
    email.send()

If we want to use async for functionB() we need to do the following

To use async function, we have to import following module:

from zappa.async import task

use @TASK before the start of function:

@task
def functionB():
    email.send()

that’s all we need to do.


Did not find what you were looking for? Open a ticket with our Help Centre and we will get back to you resolve your issue.Click Here.
Was this article helpful?
How can we improve this article?
Need help?