set_page_config() can only be called once per app, and must be called as the first Streamlit command in your script.
Steps to reproduce
import streamlit as st from st_pages import Page, Section, show_pages, add_page_title st.set_page_config(page_title="OGT Web Toolbox", page_icon="🧬", layout="wide", initial_sidebar_state="expanded") def main(): """Main function""" show_pages( [ Page("src/main_page.py", "OGT Web Toolbox", "🧰"), Section(name=" tools"), Page("src/other_pages/calc.py", " Batch Estimator", "🧮"), ...[removed for brevity] ] )
I have a streamlit app with multiple subpages setup as seen above.
Initialy I had a st.set_page_config on each subpage and I thought the error I was having was related to that.
However, I have not removed all of those instances and still streamlit complains about
set_page_config() being called multiple times and not being the first Streamlit command in myscript.
What am I doing wrong?
- Streamlit version: Streamlit, version 1.21.0
- Python version: Python 3.10.9
- Using Conda
- OS version:
- Browser version: