When a script is unloaded, its action preunload is called. The return value is saved as script persistent data. When the script is loaded again later, it can use ScriptPersistency(read) to read the data saved.

ScriptPersistency(remove) deletes the data from disk.

Note: the data is per script id, not per script file name.