Hot-Reloading Issue

This is likely due to the infinite while loopwhich never finishes, and so the streamlit app never finished running through a single iteration of a page, and so won’t respond to other changes.

If you remove the while loop, it should work fine. If you need to rerun something every 5 seconds, you might consider using the new experimental fragment ⚡️ Launched in 1.33: st.experimental_fragment

Here’s a version of your app with st.experimental_fragment, and it works fine with hot reloading if you change something on the page.

import streamlit as st
import pandas as pd
import numpy as np

st.title("Example Page")

if "data" not in st.session_state: = pd.DataFrame(np.ones(24), columns=["data"])

line_container = st.empty()

def update_line():
    with line_container:
    st.session_state["data"] += 1

1 Like