How can I call an external command (as if I’d typed it at the Unix shell or Windows command prompt) from within a Python script? Follow the below method to call external commands in Python using SubProcess which is more flexible and provide error handling. The subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using this function [os.system()]., *, stdin=None, stdout=None, stderr=None, shell=False, timeout=None)

Look at the subprocess module in the standard library

from subprocess import call

call(["ls", "-l"])