Update st.metric with data from API

Hi everyone,

Couldn’t find a clear answer to this on the forum.
Is it possible with the way Streamlit works(by re-running scripts) to have the st.metric widgets update when new data is received from an API for instance?

I’ve tried to build a loop/tried a time.sleep to fetch API data but Streamlit didn’t like that at all.
Is there some way the widget can be provided with new data without touching any components or without refreshing the page? Would be nice to build a realtime updating dashboard this way.
Sounds like something asyncy is needed to solve this.

Thanks in advance :slight_smile: