So I got a small bug in this program but I really couldn't figure out how to fix it and I would be very appreciated it if someone could help me point out where it is. So basically, the first function converts a sorted array to a balanced binary search tree and the second function returns the height of the tree from a given node. When I compiled the program, I got an error like this:

I tried to print out the "aNode" object to test and I was surprise to find that at first it pointed to a Node object, but then pointed to a Tree object(?), which I was really confused and really don't know how to debug this. Thank you very much for any help.
class Node(object):
def __init__(self, data):
self.data = data
self.lChild = None
self.rChild = None
class Tree(object):
def __init__(self):
self.root = None
# create a balanced binary search tree from a sorted list
def create_tree (self, a_list):
if (len(a_list) <= 0): return None
mid = (len(a_list))//2 # find the mid value of the sorted array & make it root
self.root = Node(a_list[mid])
self.root.lChild = self.create_tree(a_list[:mid])
self.root.rChild = self.create_tree(a_list[mid+1:])
return self
def get_height (self, aNode):
if (aNode == None):
return -1
else:
print(aNode) # I DID MY TEST HERE WHERE IT FIRST PRINT "NODE OBJECT", BUT PRINT "TREE OBJECT" LATER AND CAUSE THE PROGRAM TO FAIL
rHeight = self.get_height(aNode.rChild)
lHeight = self.get_height(aNode.lChild)
return (1+rHeight) if rHeight > lHeight else (1+lHeight)
def main():
new_tree = Tree().create_tree([1,9,11,17])
new_tree.get_height(new_tree.root)
main()
Thank you very much!
