I have bunch of python scripts I am calling from a parent python script but I am facing trouble using the variables of the scripts I called in parent python script. Example of the scenario:
parent.py:
eventFileName = './0426_20141124T030101Z_NS3_T1outside-TEST-NS3.csv'
execfile('./parser.py')
print(experimentID) #I was hoping 0426 will be printed to screen but I am getting an error: global name 'experimentID' is not defined
./parser.py:
fileNameOnly = (eventFileName).split('/')[-1]
experimentID = fileNameOnly.split('_')[0]
any suggestions? (The above is just an example of a case I am working on)
eventFileNameinparent.py. You should be able to run both files. But the point of the question is I am not able to useexperimentIDinparent.pywhich is originally populated inparser.py.