When driver.py
finishes running, email.send_email()
is executed. This is because in the driver, it is registered in the atexit
module:
import atexit
atexit.register(send_email)
which means that when the driver is finished and is about to exit, the send_email()
function will be the last thing that runs. In this example send_email()
simply prints that it's sending an email, but this is where you should actually email report_obj
out.
See this script in action.