Python: NameError: global name 'foobar' is not defined [duplicate]

Python doesn't scope code to the local class automatically; you need to tell it to.

pp = self.foobar(arg1, arg2)

http://docs.python.org/tutorial/classes.html