Very basic help needed. Learning to code

You need a reference to the child device.

getChildDevice(DNI) is the interesting method. I frequently follow a pattern of getChildDevices() followed by iterating over the resulting list to find the specific child that I wanted to operate on. You can call a driver method directly that way, including all (or most?) of the methods on the device object: https://docs.hubitat.com/index.php?title=Device_Object

I'm not sure exactly how to get and set state directly, but I'd make get/set accessor methods personally (similar to what @bertabcd1234) described.