How do I rerun a streamlit script?

How can I re-run a script every x hours?
My command - streamlit run

My attempts -

import schedule
import time
import os

# run command
def job():
    os.system('streamlit run ../')

# schedule everyday
# keep running
while 1:


This script runs fine but doesn’t update new entries from the database. I have to manually stop and start to see the changes.

Second attempt

Not sure how to use this script.

Folder structure

main folder
    scheduler folder

Wish to trigger from the Thank you.

Hi @anansrivastava -

This seems like your process would be better written as a shell script, instead of a Streamlit app. Meaning, if there’s no user, why use a user-interface library?

What is the higher level goal you are trying to accomplish?