When running a function outside of the Hype document, you’ll need to include the document’s name (chosen when you export as HTML). If your document were named DocumentName, you would use this function:
HYPE.documents['DocumentName'].functions().MyFunction(HYPE.documents['DocumentName'],'foo',event);
(Edit: February 8, 2016 to fix the above function)