0

I want to pass a value in a function from another script using a for loop.

Eg.

Test.py

from testing import *
     print(y)

Testing.py

import os

for y in range(1,100):
    os.system('Test.py')
Manish Saini
  • 113
  • 3
  • 11
  • system call is not a function... if you're talking about arguments you can use `'Test.py {}'.format(y)` – Jean-François Fabre Oct 24 '16 at 07:37
  • Hi @Jean-FrançoisFabre its still not working can you help by writing the code. – Manish Saini Oct 24 '16 at 07:40
  • Possible duplicate of [What is the best way to call a Python script from another Python script?](http://stackoverflow.com/questions/1186789/what-is-the-best-way-to-call-a-python-script-from-another-python-script) – Dmitry Yantsen Oct 24 '16 at 08:09
  • What exactly do you want to do here? Could you not just import test.py in your testing.py script? – Metareven Oct 24 '16 at 08:27
  • @Metareven I want to pass value from a loop to another python script. – Manish Saini Oct 24 '16 at 09:15
  • @ManishSaini, what I have understood is like you want to send more then one value when function is called and function is in different python file. Is it that what you want to say ? – Raj Damani Oct 24 '16 at 10:03
  • Yes i want to send iteration of values from loop to a function in different python file.@RajDamani – Manish Saini Oct 24 '16 at 10:10
  • @manishSani To me what you're asking for makes no sense. In your example you just print a string to standard out. Do you want to share variables between two python programs? Do you just want to run another python script from within another script? Do you want to import the file? If you want to share state between processes I suggest you read the python documentation for the multiprocessing library – Metareven Oct 24 '16 at 13:20

0 Answers0