Question of the day 'Accessing properties from children'

so…How can I access properties from children?

I make a list of the child objects

  1. subObjects = own.children

but I cannot acces their properties…I tried

if ‘property’ in subObjects[‘this child object’] == value:
do this amazing stuff here

but it does not work…can’t find any answer in the 20 seconds that I looked :wink:

EDIT: accessing works like any other property in python…I just did something wrong initially
correct:
if subObject[‘this child object’][‘property’] == value:

use the name of the child

monster.children[“sword”][“some property”]

or the index

monster.children[0][“some property”]

your first example was the first thing I tried…and the very first time I tried to access the children I was trying the index…but I must have messed something up…I will try again. thank you…I’ll edit the firts post if I get it to work.


for child in obj.children:
   if child["property"] == something:
      do stuff