Solved, subprocess works perfectly but had to use:
if st.button("Process data"):
subprocess.Popen(['python','processor.py',selected_file])
I know similar issues has been posted before, but I couldn’t relate it to what I am trying to achieve.
Let’s say a user has a st.button they can click. Upon clicking they tell the underlying server to start processing a large file that might take ~24 hours to process and they might get a brief st.success message “Processing has started, please come back later”.
*After clicking the button the user might still want to use the app for other tasks and will come back the next day to check the results of the first file. *
What is the current best practice to spawn in underlying process and keep using streamlit (with having the constant running)? This approach underneath just seems to leave the current streamlit window running:
sudo code:
```
- import subprocess*
- import os*
raw_files = os.listdir(“raw_data/”)
selected_file = st.selectbox(“Select file to process”,raw_files )
if st.button(“Process data”):
- subprocess.run(f"python processor.py {selected_file}", shell=True)*
```
Any ideas?