When I call func1 from func2, I get an error. Why is this occurring and how to access the returned dictionary d in func1 from func2?
func1() NameError: name 'func1' is not defined
class ABC():
def func1(self, a):
d = {}
###do something with a
###return ending dictionary d
return d
def func2(self):
###Retrieve returned dictionary d from func1 and use
func1()
d['key'] = value
class ABC:parthensis are not needed hered = self.func1()calling a method and setting returned value tod(although you could use a completely different name here, e.g.result = self.func1())