Super simple streamlit app reruns on start (side/effect), not clear why

I just have this simple streamlit Hello.py

import streamlit as st

st.set_page_config(
    page_title="Hello",
    page_icon="πŸ‘‹",
)

st.write("# Welcome to Streamlit! πŸ‘‹")

st.sidebar.success("Select a demo above.")

st.markdown(
    """
    Streamlit is an open-source app framework built specifically for
    Machine Learning and Data Science projects.
    **πŸ‘ˆ Select a demo from the sidebar** to see some examples
    of what Streamlit can do!
    ### Want to learn more?
    - Check out [streamlit.io](https://streamlit.io)
    - Jump into our [documentation](https://docs.streamlit.io)
    - Ask a question in our [community
        forums](https://discuss.streamlit.io)
    ### See more complex demos
    - Use a neural net to [analyze the Udacity Self-driving Car Image
        Dataset](https://github.com/streamlit/demo-self-driving)
    - Explore a [New York City rideshare dataset](https://github.com/streamlit/demo-uber-nyc-pickups)
"""
)

print("haha")

I run it with streamlit run Hello.py,
however, I am seeing that the haha prints between 2 to 4 times…
Should I expect that it should only be called once? What is causing the rerun?

:rotating_light: Before clicking β€œCreate Topic”, please make sure your post includes the following information (otherwise, the post will be locked). :rotating_light:

  1. Are you running your app locally or is it deployed?
    locally
  2. If your app is deployed:
    a. Is it deployed on Community Cloud or another hosting platform?
    b. Share the link to the public deployed app.
  3. Share the link to your app’s public GitHub repository (including a requirements file).
  4. Share the full text of the error message (not a screenshot).
  5. Share the Streamlit and Python versions.

Hi @hackgoofer

Typically, when there’s widget interaction, these would trigger an app re-run. Were there also other widgets in the sidebar?

Hi @hackgoofer,

haha prints only once for me. Maybe, you could either try:

  1. closing your DOS & browser windows of your streamlit app and reload your app again to check
  2. If that fails, re-install streamlit

Cheers

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.