Try to use window.parent.postMessage(“msg”, “*”) and do a test.
Did you import the hubspot scripts?
Test the function outside the form create function.
console.log the event onMessage.
You should see the window object on Dev Tools log (Chrome F12).