Hi all,

I have got several python scripts and I need to run them in one shot.
So I assume that in a .py file I can give statements ./file1.py
./file2.py
./file3.py
etc to run multiple scripts.
I am defining global variables in a config.py file and these will be shared by the 3 scripts(file1.py, file2.py and file3.py).
Now I need to use a parameter in each of the scripts : INITIAL_SOCKET_NUMBER = 10000.
So this needs to be part of the config file.
Now in the file1.py, I need to create 20 sockets. So INITIAL_SCOCKET_NUMBER + 20 would be final socket number. I then want to pass this value to the file2.py. file2.py should create and use 20 more sockets and it should pass INITIAL_SOCKET_NUMBER + 20 + 20 to file3.py.... and so on...
Could any one please tell me how to do this?

Regards,
Prashanth

Not sure exactly what you're asking, but you can do it like this:

# file1.py

class File1:
    file1var = "Something"
# file2.py
from file1 import File1
# Do something to File1.file1var

Hi , thanks for the reply. The answers have helped me in solving my problems.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.