0

I am sorry if this question is basic, but I have been trying to solve this problem for some time now and cannot figure my way around it.

What I would like to do is have two (or possibly more) python files files -- each taking the concerned input variable(s) from the other and processing them as designed before passing them back to act as the input variable(s) for the other other in a potentially infinite loop.

It's a bit hard for me to adequately articulate with words, so hopefully the very rough mock-up below can act as example.

One.py:

while(Status == Active):
     InfoUpdate = input()

     import Two
     varOut = Two.varOut

     if(varOut == "Done"):
          Status = "Inactive"
     if(varOut == "Not Done"):
          Status = "Active"

Two.py:

import One
InfoUpdate = One.InfoUpdate

if(InfoUpdate == "Continue"):
     varOut = "Not Done"

if(InfoUpdate == "Stop"):
     varOut = "Done")

I apologize for any general errors in this example -- I am very new to import operations in general. Please help if you can -- thank you in advance!

1 Answer 1

1

it is alright to ask basic questions here. The answer to your question is to use a different python script, and storing all your shared variables inside the new script. Here is what has to be done

#config.py
InfoUpdate = "none"
varout = "none"
#One.py
import config
while(Status == Active):
     config.InfoUpdate = input()
     import Two
     if(config.varOut == "Done"):
          Status = "Inactive"
     if(config.varOut == "Not Done"):
          Status = "Active"
#Two.py
import config
import One
if(config.InfoUpdate == "Continue"):
     config.varOut = "Not Done"

if(config.InfoUpdate == "Stop"):
     config.varOut = "Done")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.