Based on the example you posted I created my own function that works better (but not 100% perfect yet)
Since I know that I have a namespace with name "releye" in the form script I iterate the frames in window.parent until I find that namespace and then I call this frame. I noticed that sometimes the frame had different indexes and therefore the code needed some adjustments..
getParentFrame().myMethod();
function getParentFrame() {
let frame = null;
for (var i = 0; i < window.parent.frames.length; i++) {
try {
let releye = window.parent.frames && window.parent.frames[i] ? window.parent.frames[i].releye : null;
if (releye && releye != undefined) {
frame = window.parent.frames[i];
break;
}
}
catch(e)
{
if (e.message)
throw e.message;
else
throw e;
}
}
return frame;
}