Execute Script Automatically or pass runtime


I have a use case where I need to run a recurring load of my data outside of the main script, but I want this to happen automatically.

I have two ways that I can think of to accomplish this:

  1. Execute the loading script that performs data load automatically when "streamlit run app.py "is run. This would require that this would happen without having to navigate to the page first from the browser.
  2. Execute the loading script as “python app.py”. However, this results in these kinds of errors:
    2023-10-18 10:43:27.273 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager
    2023-10-18 10:43:28.764 Session state does not function when running a script without streamlit run

Is there a way to accomplish either of these solutions?

If I am correct, you want to automatically refresh the page/app after x period of time or every x period of time lets say 5mins?

This package might help with this.


Not really. Right now, a streamlit page executes the whole script top to bottom whenever it is opened on a browser or browser API. I don’t want to have to browse to my streamlit page in order to have the code for that page executed. I want to keep this page perpetually open, preferrably not on my host system.