Reputation: 343
I have two scripts, A.py
and B.py
let's call them. A
is an independent script that can run on its own, but can also be run by calling it from B
. B
on the other hand needs A
to complete. I need to include something in my A
script so that a couple configurations can be altered depending on where it's being called from.
I'm calling A
from B
like this: subprocess.call("A")
What can I do to let A
know that it was called from B
?
Upvotes: 1
Views: 58
Reputation: 42758
Use command line arguments:
subprocess.call(["A", "--called-from-B"])
Upvotes: 2