Whenever i run the streamlit intially i getting the below error
streamlit.errors.StreamlitAPIException: set_page_config() can only be called once per app, and must be called as the first Streamlit command in your script.
after refreshing the page the error is gone and im using the set_page_config()` only once in the script
Thanks for sharing your question with the community! Check out our guidelines on how to post an effective question here and please update your post to include a code snippet (+ what version of Streamlit youâre running) so we can try to reproduce the issue.
import streamlit as st
import os
from utils import*
import pandas as pd
import numpy as np
import pandas as pd
from dtaidistance import dtw
import mass_ts as mts
from bokeh.plotting import figure, output_file, show
import plotly.express as px
import matplotlib.pyplot as plt
import math
import plotly.io as pio
from plotly.subplots import make_subplots
import plotly.graph_objects as go
import copy
from golden_batch import *
from Polluted import *
from PIL import Image
import warnings
warnings.filterwarnings(âignoreâ)
st.set_page_config(page_title=âDashboard for Batch Analysisâ,layout=âwideâ)
nav =st.sidebar.radio(âNavigationâ,[âBatch-Analysis-1â,âBatch-Analysis-2â])
if nav == âBatch-Analysis-1â:
col1, col2, col3, col4 = st.columns(4)
with col1:
if 'batch_cond' not in st.session_state.keys():
batch_condObj = cUpload("Choose a file for Non-Golden batch")
batch_cond = batch_condObj.FileuploadDisplay()
else:
batch_condObj = st.session_state['batch_cond']
batch_cond = batch_condObj.FileuploadDisplay()
My guess, which is purely a guess since I canât see the other files in your repository, is that you have some streamlit commands being run in your utils module, so that when you do from utils import *, it actually runs st.<something>. Can you check all of the modules youâre importing from, and see if there are st commands running in them? If so, you could put those inside a function so they wonât run just by importing the module.