I am planning to create a multi-page Dash app in which different pages will read from the same DataFrame. I could create the DataFrame via a SQL query on each page, but that seems inefficient compared to creating it once and then accessing it across pages. Similarly, I would like to establish certain variables on a single page that I could then import into other pages.
What would be the best way to access the same DataFrame or variable on different pages within my app?
Thanks for recommending dcc.Store. If I’m interpreting the documentation correctly, it looks like trying to send more than 2 MB within a browser setting may be risky (depending on users’ browser limitations). Therefore, I’m now thinking of just placing all of my pages within the same app.py file, as shown here. This makes for a pretty long file, but at least all of my pages can access the same data sources and variables without any need for dcc.store.
Are there any limitations with the single-page approach besides the fact that it makes the code base a bit harder to read/interpret?