Download PNG file from a local directory

Hello I have a function that saves a pyplot figure as a png to a local directory and I was wondering if anyone knew how to download that file to the downloads folder. I understand that it is already created and saved locally, but the people I’m creating the application for would like it so it’s easier to access instead of looking for the current working directory.

My code right now is this:

def download_monthPlot():
return send_from_directory(PNG_DIRECTORY, ‘allProducts_MonthFigure.png’, as_attachment=True)

@app.callback([Output(‘monthDownload’, ‘pathname’)],
[Input(‘downloadButton’, ‘n_clicks’)])

def downloadMonthPlots(n_clicks):
if n_clicks > 0:
#creates plots of all graphs
allProductsMonth(productNames, closedYieldMonth)
download = [’/dash/downloadMonth’]
return download
raise PreventUpdate

The first time I run the program it works fine. The application gets the correct png file and downloads it, but if I update the data values or change the png the file that gets downloaded is the same as the original. I was thinking that the Dash application keeps a local server where it’s accessing the original png I load in on the first run and will just continually refer to that file even when I update the png file in my local directory. If anyone knows if this is correct and knows how to update the png file in the server or if this is totally wrong and there’s an easier way to do this I would greatly appreciate your help.