St.Set_Page_Config use in Multipage apps

Hi everyone,

So I have just rebuilt my multipage app using the now native functionality! On my landing page I have set st.set_page_config to collapse the sidebar, which works perfectly.
I read the docs and it seems to me that I can use st.set_page_config once per page, so I have set it again on my other two pages, but this time I need the sidebar to be set to ‘expanded’.

So my issue is that about 1/3 of the time I load into my second and third page I get the error stating that st.set_page_config can only be used once.

Anyone know why this is happening? I have set st.set_page_config outside of any function and it is the first piece of streamlit to be called on all pages. Is my reading of the docs wrong? In which case does anyone know how to set the size of the sidebar automatically?

I’m running on the latest version of Streamlit using Vscode and venv if that helps.



Hi @Halfbrowse,

Thanks for sharing your question! st.set_page_config is actually limited to one call per app rather than per page – check out this GitHub Issue here and feel free to add your thoughts to the discussion.

Caroline :balloon: