I’m trying to set my Python programs in classes. But when I have this:
class program:
def test(value):
print value + 1
def functionTest():
a = test(2)
if __name__ == "__main__":
functionTest()
I get the error : NameError: global name ‘test’ is not defined
What do I have to do to ‘activate’ the test-method?
Thanks a lot!
selfas an argumenttestwithself.test()All that above is assuming you actually want a class and use it in your code. If not, have a look at @brandizzi’s answer