Just started learning python and I am sure its a stupid question but I am trying something like this:
def setavalue(self):
self.myname = "harry"
def printaname():
print "Name", self.myname
def main():
printname()
if __name__ == "__main__":
main()
The error I am getting is:
NameError: global name 'self' is not defined
I saw this way of using the self statement to reference variables of different methods in some code I read that is working fine.
Thanks for the help