✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

File updated but always downloads the first version

I have an issue with an application which creates (or updates) a file to download it and print it.
When the user press an ‘export’ button, two additional buttons are created. One for downloading and another one for printing.
The thing is, I press the export button, the other two buttons are created, and I download the file correctly. Then I modify some graphics on the screen and click export again, (with the two buttons already created), and then I make sure, the new overwritten file is in the server with the same title (but different data), but when it comes to download it, I get always the old version. I’ve tried to fix it but I don’t know what more to do.
Any help is appreciated, I attach the chunk of the code.

def downloadfile(doctitle):
        return send_from_directory("",doctitle,as_attachment=True)

   #some more stuff
def exportfile(n_clicks,more parameters...):
    if n_clicks==None:
        raise PreventUpdate
        #processing stuff...
        if os.path.isdir(mydir)==False:
        return  [
                html.Div('Select export mode:'),
                html.Button('Print', id='print-button'),
                html.A('Download', href="../download/mydir/doctitle)