The child doesn't actually access the database. It runs a few backtick commands and processes the results. All of the database access is done from the parent.
I have another function that works in a similar way but the parent pushes data to the child, and it works OK.