Load javascript after render completed

Good day,

I am having trouble in consistently loading an external javascript after the view:render has terminated (and not before which causes element not found).

render: function (data) {
    var wrapper = E("div", { id: "wrapper"});
    var mapContainer = E("div", { id: "mapContainer"}, ["Waiting for Map"]);
    wrapper.appendChild(mapContainer);
    wrapper.appendChild(E("script", { src: "/luci-static/hr/js/googlemaps.js" }));
return wrapper
}

Sometimes the script gets loaded and triggers the callback before the render is completed and then the callback fails.
What would be the proper way to load external javascript after the render has completed?

Thanks
Michael

Where in openwrt is this

www\luci-static\resources\view\test\test.js