Hi Sean,
like you already said, at the moment you need to define these event listeners at the top of the first Blockly script because of the way how synchronous Blockly in CoSpaces Edu works.
But we are working on an importing/exporting feature which will make it possible to export a variable or function in one script and import it in another script and use it there. This will make it easier to organize your code.
I’m not sure about an onload event listener in the context of a Blockly script in CoSpaces. This is different from document.onload which is mostly used to prevent executing certain JavaScript before the browser has build the DOM tree. But it’s an interesting idea and I’ll talk to the team.