Load data once and retrieve in multiple pages

Hi @asanoop24 and @saurabh_joshi and welcome to the Dash community :slightly_smiling_face:

This is a great question!

As mentioned by @saurabh_joshi , if you aren’t working with large datasets, then using dcc.Store is the easiest way to share data between pages of a multi-page app.

However, if you have larger data, then you may want to use caching as described in example 3 and 4 in sharing data between callbacks chapter of the dash tutorial. Part 5. Sharing Data Between Callbacks | Dash for Python Documentation | Plotly

If you are using the pages/ feature to make a multi-page app, there are some new features in dash 2.5 (soon to be announced) that will make this much easier. There is a new get_app() function that can be used to access the app object from modules within the pages folder without running into the circular imports issue. You can see an example based on the dash-tutorial here: dash-multi-page-app-demos/multi_page_cache at main · AnnMarieW/dash-multi-page-app-demos · GitHub

Multi-page app (without using the pages/ feature)
With a multi page app, that does not use the pages/ feature, you can refactor your project so that you define the app and the cache in a separate file (app.py). Then in all the other modules, you can use from app import app without running into the circular imports issue.

The app structure would look something like:

- app.py 
- index.py
- pages
   |-- __init__.py
   |-- page1.py
   |-- page2.py