All projects exist in the gateway. All leaf projects (that is, non-inheritable) can have project-specific gateway event scripts: startup, timer, tag change, message handler, shutdown, and scheduled. (Non-inheritable projects can also have them, but they won't run there, just where inherited--that way lies madness.)
Certain gateway objects, particularly tags, do not belong to any project, and do not naturally have access to library scripts. A single project, not necessarily a leaf project, can be specified as the "Gateway Scripting Project", making its scripts accessible from tag events (attached to the tag) and/or expression tags using runScript()
.
Consider using project inheritance to organize your project library: