How to get a list of an object's children?

Hiya,

If I have an object “obj” how can I get a list of it’s children?

I notice that the object class has a “parent” property, I was hoping for a “children” property too, which would have been a list (potentially empty) of the objects children.

Sorry for the probably noobish question but I looked through google, the forum search and the python api reference index and couldn’t find the answer. Maybe I missed something obvious.

Thanks in advance.


import bpy 
 
 
def getChildren(myObject): 
    children = [] 
    for ob in bpy.data.objects: 
        if ob.parent == myObject: 
            children.append(ob) 
    return children 
 
 
 
#then if you have an object you find it's children by 
 
myObject = bpy.data.objects['Cube'] 
children = getChildren(myObject) 
for c in children: 
    print c.name 

Wow awesome : ) Thanks alot!