Hello @anshul,
Streamlit reruns the whole script each time a widget is updated. So, if you load your data in the Data Injection page, your df will be defined. However, once you click on EDA, the whole script will reload, it won’t branch into the first if statement, and df won’t be defined anymore.
If you want to keep a paging system with some state, I invite you to take a look at this to give you some ideas : Multi-page app with session state.
Beware that this solution is not perfect as it uses some hacks to get everything to work.