We briefly discussed this module in the previous chapter. The subprocess module (https://docs.python.org/3.2/library/subprocess.html) enables launching another program from within a Python program. One of the commonly used functions from the subprocess module is Popen.Any process that needs to be launched from within the program needs to be passed as a list argument to the Popen function:
import subprocess
if __name__ == "__main__":
subprocess.Popen(['aplay', 'tone.wav'])
In the preceding example, tone.wav (WAVE file that needs to be played) and the command that needs to be run are passed as a list argument to the function. There are several other commands from the subprocess module that serve a similar purpose. We leave it to your exploration.