somehow this code caused streamlit to repeatedly open my browser and load the page, but then fail to load the content, does anyone know why?
Hey @henosBot ,
you could try to put it into the main function of run.py.
if __name__ == "__main__":
os.system(f'streamlit run app.py')
Inside the app.py you do all the streamlit commands like st.write().
def app():
st.title("hello")
if __name__ == "__main__":
app()
Maybe that helps?
Is this not an infinite loop? Why are you calling Streamlit from inside of a Streamlit app?
So when I press run, it runs the app
It needs to be before my import streamlit, BC that invokes numpy, and my computer has the fmod issue
I’m not following…where are you pressing run
? You can run your Streamlit app from the terminal as streamlit run app.py
, you don’t have to use a subprocess from Python to do it.
im running the file in vsc
Instead of using that workflow, in Visual Studio Code, open a terminal and run streamlit run app.py
and leave the terminal running. Then, you can have app.py
open in the text window, and with our hot reloading functionality, every time you save the Python script, the changes will appear in the browser.
The way you have written it is an infinite loop as far as I can tell. You hit the ‘Run’ button, which uses Python to create a subprocess to evaluate a Streamlit app, and that Streamlit app creates a subprocess to run your Streamlit app…forever.