Thank you both for your responses.
jupe wrote: ↑07 Apr 2025 21:01
... it requires using "p" and saving a temp file with
savesettings
.
Your suggestion helped me find the answer

(I found I didn't need to use "p" before saving the temp file).
I have a script (script1) that calls a function in another (script2). I'd moved my
setting
statement from script1 into script2, where
savesettings
proved that my statement was still working. However, when script2 ended and code execution continued in script1, another call to
savesettings
showed that the setting had been reset to the default.
I then realised that when the help says:
all modified options are restored automatically by XY when script execution ends
it does not mean that this happens when all script execution ends, but when the script that changed the settings (script2) ends.
This makes sense. Thank you for helping me towards the answer.