There are two ways this issue is generally handled.
1.) Instead of using a window, create a div in the page. The div can optionally contain an iframe.
2.) A window can be opened without warning in most browsers if the action follows DIRECTLY from a user initiated action.
If the bookmarklet first appends a script file, and then the code in the script file opens the window, this is not direct.
If however the bookmarklet code itself opens the window, this is direct. This will work.
A hybrid solution could be to have the bookmarklet open the window, and then append a script file. The code in the appended script file could then use the already opened window.
If your sample code is close to what you really want to use, I would just use it directly in a bookmarklet and skip the step of appending an external file.