How to use async function in python

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

1 2 3 4 5 6 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:

1 from zappa.async import task

use @TASK before the start of function:

1 2 3 @task def functionB(): email.send()

that’s all we need to do.