Despite the fact that I find this question really strange, I will try not to go deeper and just anwser. Rewrite the imported scripts with something like this:
window.js7711 = function() {
Then, when you download this inconvenient thing, you should execute it js7711()
And when deleting, I assume that you are doing something like:
var myID = "js7711"
$("#" + myID).remove();
add this:
delete window[myID]
If you declare functions in this imported script, you should consider adding an array with the names of the imported functions js7711.imported = ["something", "trololo"] , and then removing them in a loop.
In any case, I think your approach / structure is a bit flawed.
source share