At the end of my app.py script I would like to launch analytics.py. Both are in the same folder. How to do? I struggle since a few days to find a solution.
Thanks in advance for your help!
At the end of my app.py script I would like to launch analytics.py. Both are in the same folder. How to do? I struggle since a few days to find a solution.
Thanks in advance for your help!
It depends on how you run app.py
and how you'd like to run the script. For example you could import a function from analytics.py
that would perform the actions the script has been written for. Or you could run it as a subprocess. We'd need more context to provide a more precise answer...
Thanks for your answer. app.py calls APIs and writes data to a .csv I then want to process the data from the .csv with another python script. I saw that subprocess.run is not allowed, I tried subprocess.POPen but without success.
How to run script A from script B: You should wrap the functionality in script A in functions that you can import into script B and call like any other function.
Thanks a lot sboyd! That's indeed a good solution.
Glad we could help!