0

I want to run another python file in a python file , passing array as parameter, not a string as parameter.

I could pass a string like this:

os.system("python another_file.py 123")

By the way , the reason why I could not import is that the Variable of tensorflow may conflict.

3
  • 1
    No. Just no. If you control another_file.py, you can find a way to do this properly by importing and calling functions in the other module. Variable names do not just randomly conflict, module namespaces exist to prevent that in the first place. This is a clear XY problem; we need more information to give good answers. Commented Dec 16, 2016 at 2:24
  • @siu: That's better than os.system (in that it doesn't implicitly involve all the problems with executing command strings in a subshell), but it's not going to fix terrible designs. Commented Dec 16, 2016 at 2:27
  • 1
    If the Variable of tensorflow may conflict, then just ensure that you are properly namespacing your modules - do an import mymodule then use mymodule.Variable. Or import Variable from mymodule as Variable_1. Do not do from mymodule import *. Commented Dec 16, 2016 at 2:28

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.