I have a simple script which is having the structure of:
if __name__ =='main':
#do some logic
#print to console the result
Now, I ran the script via the code using subprocess.Popen()
method like this:
p = subprocess.Popen(
["python", path_of_script_to_run] + arguments_list,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
My question is how can I return a value from the running script to the calling script using return value, or other method.
I cannot use return under the context of if __name__ =='main':
So does it mean I cannot pass a return value to be assigned in the calling script to the p
variable?
I'm also want to try avoiding parsing the prints of the script run to the console..