Is there a way to return value to outside of dash app

Hi experts,

I have a Dash application that consists of several dropdown menus and one button. What I’d like to do is to return the content in the dropdown menu as a list to another python program that uses that list to query a SQL Server, and the result will be stored in a Pandas Dataframe and export back to the Dash app and display as a Dash-table.

I can move data into Dash app by programming it as a function and pass the Dataframe as a parameter. However I’m not sure how to get the list out from the Dash app. I can add an app-callback decorator using the button as input, but where should it output to? The only solution I found is to use a global list in the main program and let Dash app modifies it.

I’m wondering if there is better way to achieve this? I found a similar question:

But I’m asking to return the list to the main program, not to store it as a file. Thanks in advance~