You can put every function in its own folder-level script.
Thanks to all who replied so far.
For example, I have a pretty large script file to animate embedded 3D models.
Is it possible to split this file into smaller pieces and share the code among multiple 3D annotations contained in a single PDF file?
Document-level scripts are not accessible to other documents/scripts, so they're not a good option.
Folder-level scripts, on the other hand, are accessible to all other documents/scripts. So if you have a general function that creates a 3D annotation, for example, you can place it in a folder-level script and then call it from other scripts (you will probably need to provide it a handle for the document and properties of the annotation).
One thing to be aware of, though, is that the folder-level scripts are loaded alphabetically, so don't put a reference in script aaa.js to something that loads in zzz.js, or you will get an error message when you open Acrobat. (this is not a problem if zzz.js is not called during the launch of Acrobat)