I have a couple of Python files which generates following error:
In Globals.py
def init():
global duty
In SCDetail.py
import Globals
#############################################################
def classify_nodes(sample_no):
filename='Sample_'+str(sample_no)+'_TDinfo.txt'
fh=open(filename,'r')
for line in fh:
tempList=line.split(':')
duty[tempList[0]]=tempList[1]
tax[tempList[0]]=tempList[2]
#############################################################
def complete_SC_detail(sample_no,num_periods,vertex1_body):
Globals.init()
sample_no=1
classify_nodes(sample_no)
In Simple.py
import SCDetail
SCDetail.complete_SC_detail(1,3,3)
(I have other functions that use the globals defined in Globals.py, in simple.py and scdetail.py. But I just gave the code mentioned in the traceback.)
When I run Simple.py, I am getting following error:
global name 'duty is not defined
I will be glad if someone can help me identify what I am missing...
Edit: I am not looking for generic explanation. I am trying to apply a method that was suggested by a previous comment and trying to locate the specific problem in the above implementation.