For some application that I am building, I have the need to schedule another Python script (or more generally, a shell script) to run immediately or later, but after I exit the current Python script. How do I achieve this? I looked through the sched module and other suggestions for similar (not same) applications discussed elsewhere on this forum. But none of them seem to satisfy my requirement. Basically what I need to do is the following (have stripped out a lot of unnecessary code in my application):
from flask import Flask, request, redirect
def incoming_msg():
attr_1 = request.values.get('some_attribute', None)
attr_2 = request.values.get('another_attribute', None)
# Schedule another Python script (or a scell script) to run immediately after
# exiting this function or at a certain time (calculated thru attr_1 and attr_2)
# This new script will need to be passed parameters attr_1 and attr_2
return
I am using a MAC platform.