I am adding multiple SVGs dynamically, then modifying each of them. Without an event listener, the map was not being seen. Now, however, the event listener appears to create multiple instances of the last loop, instead of one for each loop, only the last instance gets modified, but multiple times with the same mygroup,svgID.
for (var i=0; i<path.length; i++) {
var mygroup = path[i], svgID = "svgMap" + i
const iSVG = document.createElement("object")
document.getElementById("summary-mygroup").appendChild(iSVG)
iSVG.id = svgID
iSVG.type = "image/svg+xml"
iSVG.data = "Maps/mygroup_basemap.svg"
iSVG.addEventListener('load', function(){
createMap(mygroup,svgID)
})
}