title: Object has no attributes
body: <pre><code>class Node(object):
      def __init__(self,value):
          self.value=value
          self.left=None
          self.right=None
  
  class Tree(object):
      def __init__(self,values):
          length=len(values)
          node=[]
          for x in range(length):
              node.append(Node(values[x]))
          for x in range(length):
              if 2*x+1 &lt; length:
                  node[x].left = node[2*x+1]
              if 2*x+2 &lt; length:
                  node[x].right = node[2*x+2]
          if node[0] != None:
              self.root = node[0]
          else:
              self.root = None
  
      def DFS(self,node,obj):
          if node == None or node.value == obj:
              return node
          else:
              self.DFS(node.left,obj)
              self.DFS(node.right,obj)
  
  def main():
      obj = raw_input("Please input a number you want to search: ")
      tree = Tree(range(100))
      node = tree.DFS(tree.root,obj)
      if node.value == obj:
          print "I've done it!"
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p>Hi, I am new to python and this platform. I want to realize DFS in my python 'Tree' class but the shell says 'Tree' object has no attribute 'DFS'. However, DFS is explicitly defined in my code. Can any one help me with this? Many thanks in advance!</p>