Smartopen in LISP

Can someone please let me know how to use smartopen in LISP and then run a set of commands using LISP. I have an issue in that when the new file is opened it seems to step out of the LISP routine?