So I need to read two csv files BUT I have to run code that selects the most recent one in a linux directory. Normally in Python I would simply put this code like this
if __name__ == '__main__':
latest_csv = get_latest_csv( the_csv_directory)
df_latest = pd.read_csv( latest_csv )
BUT I am hitting a problem. IF I put this code in a DASH app ( which works FINE if I hard code a csv file name) then the code below does NOT see the df_latest for some reason. Where am I supposed to put the code to designate any criteria needed to select the csv files?
html.Div([
dash_table.DataTable(
id='datatable_id',
columns=[{"name": i, "id": i} for i in df_latest.columns],
data=df.to_dict('records'),