We have been working on this a bit.
Put this at the top of the script:
# flag: python.reloadEngine
That will reset the engine each time it runs. This can take some extra time to reload, but does allow libraries to be reloaded if those happen to be changing often.