st.container looks like a way to define where things are, but defer loading:
st.container - Streamlit Docs
I havne’t tried it, but I use a similar concept with columns - I’ll define the columns, but fill them after I run some other code.