Black Lives Matter. Please consider donating to Black Girls Code today.

Using APScheduler with Dash

I want to add cron jobs to my Dash app and came across this stack overflow thread:

All I want it to do is send an email automatically if certain conditions are met. Would this be the way to go? Any other ideas?

Sorry, I’m not a programmer, I just play one in my job.

Thanks all!


I was struggling a bit with scheduling in Flask. If you are looking for a job to run on a schedule, e.g. send an email every 1 hour or something like that, then I found this tutorial very informative.

Alternatively, if it is based on user actions e.g. if a user presses a button then send an email. I would suggest using the Dash Callbacks which call a function that sends an email.

It’s hard to say exactly what is the best solution without more information about what exactly you are trying to achieve and to be able to see a code example.

Nice, thank you very much!

I ended up using APScheduler, which has some issues in debug mode because of the extra threads, but in deployment it works fine.

Can you share how to prevent appscheduler running multiple times in multiple worker environment in production?