How to make the page not rerun

i have 3 pages(using selectbox). and on page 3 there is a file.uploader component. If I upload a file on page 3 then I go to page 1 or 2 then the file and the whole process shown on page 3 will be lost. How to solve that so that when I return to page 3 the file and display will stay.

def load_dataset(data_pred):
  df = pd.read_csv(data_pred)
  return df
def app():
  data_pred = st.sidebar.file_uploader("Upload your csv",type=['csv'])
  if data_pred is not None:
    df = load_dataset(data_pred)
    if st.sidebar.button("predict Data"):

I think you can accomplish the same result with st.sidebar, st.form and st.form_submit_button, and use session_state (Session State - Streamlit Docs) to keep some of the features you want when the user changes the values in the selectbox.