add_child not detected during runtime

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By CypherElf

Team,

I have question around add_child. The code that I use adds a child to a node. Once added, I need a code to detect if any empty nodes exist in GridContainer so that I can add new children.

I keep getting the same Panel over and over.

In a remote view, I can see child added, but on the code below it shows as null - why?

for inv_panel in get_parent().get_children():
	if inv_panel.item == null :
		return inv_panel

Hi,
what is inv_panel and what is item? Why should it be not null? YOu have to provide more code.

klaas | 2020-09-04 16:30

What is item? Also you can do if get_parent().get_child_count() == 0: to check for any child nodes.

Magso | 2020-09-05 14:23