I have a python script and want to call a subprocess from it. The following example works completely fine:
Script1:
from subprocess import Popen
p = Popen('python Script2.py', shell=True)
Script2:
def execute():
print('works!')
execute()
However as soon as I want to pass a variable to the function, I get the following error:
def execute(random_variable: str):
SyntaxError: invalid syntax
Script1:
from subprocess import Popen
p = Popen('python Script2.py', shell=True)
Script2:
def execute(random_variable: str):
print(random_variable)
execute(random_variable='does not work')
Does anyone have an idea why that could be the case? Couldn't find anything about it online :(