I found the solution so here it is for anyone else that may run into this.
In the parent script define the function like this
window.parent.parentscript = function() {
In the iframe you refer to the function like this
window.parent.parentscript()
Apparently CRM 2016 loads iframes more then 1 level deep.