In bash, I can do the following:
for f in subdir/*.sh; do
nohup "$f" "$@" &> /dev/null &
done
in other words, it runs all *.sh scripts in subdir in the background, and detached so that if the main script ends, the background scripts won't be terminated.
Now, let's say I have the following Python project:
proj/
__init__.py
main.py
subdir/
__init__.py
mod_a.py
mod_b.py
mod_c.py
How do I do something similar to the bash script? But with parameters passed as Python objects?
E.g.: I have two strings a and b, a list l, and a dictionary d
- Load
mod_a.py, invokemod_a.main(a, b, l, d), and detach - Load
mod_b.py, invokemod_b.main(a, b, l, d), and detach - Load
mod_c.py, invokemod_c.main(a, b, l, d), and detach main.pycan end, lettingmod_a,mod_b, andmod_crun in the background until completion