The call function

How to call another process in python?

We'll cover the following...

The subprocess module provides a function named call. This function allows you to call another program, wait for the command to complete and then return the return code. It accepts one or more arguments as well as the following keyword arguments (with their defaults): stdin=None, stdout=None, stderr=None, shell=False.

Let’s look at a simple example:

Press + to interact
import subprocess
subprocess.call("notepad")

If you run this on a Windows machine, you should see Notepad open ...