Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | lalel345 |
how to know which parent has a child
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | lalel345 |
how to know which parent has a child
Reply From: | Ertain |
Why not check the node’s parent against the node you’re trying to find?
if desired_parent == child.get_parent():
print("desired_parent is the parent of child.")
You can also check for the name of the parent:
if child.get_parent().get_name() == "correct parent":
print("The correct parent is found.")