Parent-Child communication

I have a Parent App with multiple instances of a Child App.
In the Child App I have a method:
def setModeRoom(mode) {…}
In the Parent App I’m trying to call that method for all the Child App instances:
def children = getChildApps()
children.each {
child.setModeRoom(“modeValue”)
}
I’m getting an error:
java.lang.NullPointerException: Cannot invoke method setModeRoom() on null object @line -1 (doCall)
What am I doing wrong?

“child” isn’t defined in your code, so it’s null. I haven’t tested this, but I think it’ll clear that error:

def children = getChildApps()
children.each { child ->
    child.setModeRoom(“modeValue”)
}

Thank you for replying philh30!
Unfortunately it’s still not working. Getting:
groovy.lang.MissingMethodException: No signature of method: script_app_7dc7a222bd3f1effc635db2bc83481a17b7fb55cbf6474faf79074a3100126b9.setModeDay() is applicable for argument types: () values:

That new error is coming from a different part of your code. It’s breaking down at some point when you’re calling the setModeDay method.

It’s all working fine now. Thank you!