I understand the want to keep main.c clean, but I (respectfully) disagree with the points above...

The first bullet item: I personally don't like hiding access to global variables; any access should be front-and-center and obvious.  Hiding things in pyi_utils.c decouples the setting of these variables from where they are declared.

The second bullet item: this creates side effects in pyi_utils_create_child().  Why not let that function do only what it says...create the child?  The parent is the one in charge of looking for the AppleEvents; so this change really seems counterintuitive to me.

But if it means the difference between accepting and not accepting this PR, I'll make the changes.