I have a simple class with an attribute that can contain a list of objects of the same class
class BoxItem:
def __init__(self, name, **kw):
self.name
You have two options:
myRecursiveFunction(..., ancestry=[])__init__ constructor, set child.parent = self for each child). This is bad if you plan to have a BoxItem in more than one box.