This solution does not directly answer the question, as it relies on your own code creating the OpenSeaDragon object. It is an implementation of @iangilman's mention of storing the viewer in a global variable. However others may find it useful. (Note that passing a global variable to a function requires a workaround - see Passing a global variable to a function)
The code demonstrates how to use the same OpenSeaDragon object to display different pictures.
var viewer3=null; //global variable
var newURL1='image/imageToDisplay1.png';
var newURL2='image/imageToDisplay2.png';
var elementID='myID';
//the loadScan function will display the picture using openSeaDragon and can be called as many times as you want.
loadScan("viewer3",newURL1,elementID);
loadScan("viewer3",newURL2,elementID);
//the actual function
function loadScan(theViewer,newURL,theID) {
    //if object has already been created, then just change the image
    if (window[theViewer]!=null) {
            window[theViewer].open({
                type: 'image',
                url: newURL
            });
        } else {
            //create a new OpenSeadragon object
            window[theViewer] = OpenSeadragon({
                prefixUrl: "/myapp/vendor/openseadragon/images/",
                id: theID,
                defaultZoomLevel: 1,
                tileSources: {
                    url: newURL,
                    type: 'image'
                }
            });
        }
        
}