core.pauseScript() pauses the execution of the script. It can be resumed with the keyboard shortcut key that is assigned to actionResume_Script. The default seems to be ctrl-d r and can be overwritten in the config.ini file (or %APPDATA%\Stellarium\Config?).
At least in version 24.4, core.pauseScript() and core.resumeScript() seem to be deprecated and scheduled for removal in a future release. The reason seems to be that the Qt6 based builds (version 1.0 later) do not offer a way to pause and resume a script (as was the case in the Qt5 based build in version 0.10 through 0.22) (compare https://stellarium.org/files/guide.pdf[User Guide, 17.5.1 Pause/Resume).