I am having two python files as 1.py and 2.py.
**1.py is as**
class A:
def __init__(self):
x = 5
y = 7
NUMBERS = self
fp = open(filePath)
temp = fp.read()
exec(temp)
fp.close()
ADD_METHOD()
**2.py is as**
def ADD_METHOD():
print NUMBERS.x + NUMBERS.y
Now My question how this NUMBERS varaible is available in 2.py file. This is example for better view of problem, i know i can do this by importing module but the problem is that i have to do solution with exec() method and ho can i get NUMBERS in 2.py file ie should i have to pass this with exec as argument or some other approach.
Any Help really appreciable Thanks
execstatement, or aboutos.exec()?execdoesn't take filenames, so that doesn't help.