title: Running a python script via command in aws lambda
body: <p>Lets say I have a python project, where using a command in my local terminal I can do something like:</p>
  <pre><code>python3 somePythonFile.py --someFlag True --someOtherFlag False -f https://www.somexmlfile/thefile.xml
  </code></pre>
  <p>If I wanted to run this in a python Lambda, would it be possible to run it the same way, without importing as a module.</p>
  <p>For example, I have tried this:</p>
  <pre><code>import subprocess
  from subprocess import Popen
  
  cmd = &quot;python3 somePythonFile.py --someFlag True --someOtherFlag False -f https://www.somexmlfile/thefile.xml&quot;
  
  returned_output = Popen(cmd)
  
  # using decode() function to convert byte string to string
  print('Converted result:', returned_output.decode(&quot;utf-8&quot;))
  </code></pre>
  <p>However this gives me an error:</p>
  <pre><code>[ERROR] FileNotFoundError: [Errno 2] No such file or directory: 'python3 somePythonFile.py --someFlag True --someOtherFlag False -f https://www.somexmlfile/thefile.xml'
  Traceback (most recent call last):
    File &quot;/var/task/app.py&quot;, line 32, in lambda_handler
      returned_output = Popen(cmd)
    File &quot;/var/lang/lib/python3.8/subprocess.py&quot;, line 854, in __init__
      self._execute_child(args, executable, preexec_fn, close_fds,
    File &quot;/var/lang/lib/python3.8/subprocess.py&quot;, line 1702, in _execute_child
      raise child_exception_type(errno_num, err_msg, err_filename)
  </code></pre>