I am working on an application. I have a common scenario in which if payment is successful I need to notify the user on email. Basically, I am inside payment function, after successful payment, I have to notify user on email, I don't want to do it synchronously. for eg:
def process_payment():
# some_payment_stuff
notify_user_on_successful_payment() # this should be asynchronously
# some_payment_stuff
return
I don't want process_payment
to be dependent on notify_user_on_successful_payment
success/failure.
process_payment()
should get completed even if notify_user_on_successful_payment
hasn't finished yet.