exceptions.AttributeError: class KeyAgent has no attribute 'delele_customer_node()'
Question: I've 2 files: customer.py & agent.py. It looks like this:

customer.py:

    
    
    from agent import KeyAgent
    
    class CustomerController(object):
    
        def __init__(self, container):                                          
            self.key =  container.agent
        def delete(self, path):
           KeyAgent.delele_customer_node()
    

agent.py:

    
    
    class KeyAgent(service.Service):    
    
        def __init__(self):                              
            pass
        def delele_customer_node():
         ....
    

Python is throwing this exception while running:

    
    
    exceptions.AttributeError: class KeyAgent has no attribute 'delele_customer_node()'
    

Even though I've imported KeyAgent class from agent.py why method
`delele_customer_node()` is not accessible from delete() of customer.py?


Answer: You must have misspelled the method name (dele**l** e? or dele**t** e?). The
KeyAgent class **does** have a method `delete_customer_node` (I will assume
that was a typo).

    
    
    >>> class KeyAgent(object):
    ...   def delete_customer():
    ...     pass
    ... 
    >>> KeyAgent.delete_customer
    <unbound method KeyAgent.delete_customer>
    

That means, the method is there. However your code is quite broken. Unless you
use the `staticmethod` or `classmethod` decorators, the first argument of a
method "must be" `self`, and you need to instantiate the class to call it. See
what happens if you try to call this method directly:

    
    
    >>> KeyAgent.delete_customer()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: unbound method delete_customer() must be called with KeyAgent instance as first argument (got nothing instead)
    

