Search code examples
inputsharing

Sharing raw input with multiple scripts


Basically I have a few scripts and a main script to control two other scripts. I am taking in raw input from my main script and I want to share the raw input with my two other scripts.

I have an if statement to also take in a user option so if the user entered option 1 then it would call script1 and execute it but for this work I need to send another piece of raw input to script 1 for it to send.

main.py import script1

print 'Please enter filename'
filename = raw_input()

print 'Please enter option'
option = raw_input()

if option == '1':
    script1.main()

I want the filename data to be sent to script1. I hope this makes sense...


Solution

  • Give script1.main() an input argument. This will allow you to pass in filename or anything else you chose.