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?