1

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?

Krin123
  • 323
  • 1
  • 9
  • 17

1 Answers1

2

Use command line arguments:

subprocess.call(["A", "--called-from-B"])
Daniel
  • 42,087
  • 4
  • 55
  • 81