Search code examples
pythonxmlpython-2.7wxpython

'Object' has no attribute 'function name'


I'm using an XML callback tag to update the values in my python code.

<import>import folder.filename</import>
<make>folder.filename.class($s1)</make>
<callback>set_foo($s1)</callback>

The set_foo function is presnt in my python code, but I still get the error at the point of calling that my class Object has no attribute set_foo.

def set_foo(self, a):
    print a

Solution

  • The problem was caused due to improper indentation. Indenting the following code in the corresponding Class resolved the problem in my case.

    def set_foo(self, a):
        print a
    def __init__(self, x):
        self.set_foo(x)