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.

DunkOnly
  • 1,682
  • 4
  • 17
  • 39
  • 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](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem); we need more information to give _good_ answers. – ShadowRanger Dec 16 '16 at 02: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. – ShadowRanger Dec 16 '16 at 02: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 *`. – Andrew Guy Dec 16 '16 at 02:28

0 Answers0