Maintaining Visual State for Sequential Steps (Multiple Button Clicks)

Hello everyone! I am trying to use streamlit to deploy an app that works in sequential steps. Basically the goal is to only show step 1 (upload data), then when they click the button to upload that data, it will then display step 2 (select column). I have this working to display them in order, but Iโ€™m missing the ability to hold state with selectbox changes. So in the current code, when I select a new column, it removes step 2 entirely (the select box and confirm button disappear). I know itโ€™s because itโ€™s embedded inside the if statement, I just donโ€™t know how I should structure it.

import streamlit as st
import pandas as pd

def main():
    """
    Upload File
    """
    df = st.file_uploader("Select File")
    if st.button("Confirm File Selection"):
        if df is None:
            st.exception("Please Select a Dataset")

        else:
            data = pd.read_csv(df)

            st.subheader("Select a Column")

            target = st.selectbox(
                "Which column?",
                data.columns)

            if st.button("Confirm Column"):
                with st.spinner("""
                    ...
                 """):
                    # do stuff


if __name__ == "__main__":
    main()