If you need to share an object created by one script with another script in different invocation - this is non-trivial. Maybe it is better to construct a repl instead of independent evaluations. Unfortunately REPL part of the new scripting API is unfinished, so there is not the same level of support. You can try to use JSR-223 for that, but you’ll loose quite some features of the new scripting probably.