The REPL uses basically just uses the show method to display output. So you can just use show(x) in your script
show
show(x)