0

I have a python script "Script1.py" that I do not change the inside of. I want to interact with its output using another script(.py or .bat). The script "Script1.py" gives a lot of options with print(), and I should choose each time.

So, is there a way to read his output and send him the right options that I need with another script?

1

1 Answer 1

2

Put the code inside a function and call it with an import. Also, you can use if __name__ == '__main__' to execute the module as an script.

def function_generic_name(arg1,arg2):
    **code**
    return something

if __name__ == '__main__':
    function_generic_name(arg1,arg2)
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.