As you know, in Apps Script you can have libraries that can be accessed from other scripts. Apps Script automatically generates a namespace for that library (it calls it an identifier) which you prefix calls to functions to that library with.

Let’s say you have a library called HandyLibrary, and you’ve included it as a resource, you can access functions in it like this

and variables in it like this
If you’ve implemented jsdoc in your library, you also get some limited autocomplete tips in the Apps Script editor when you save a version.

One useful benefit of namespaces is that you can limit the risk of global  name collision (multiple scripts declaring the same global variable or function name for different things), since multiple namespaces can have the same locally named function – so

is not the same as

Local namespaces

If you are developing a large project with multiple script files, and especially if you are copying code from existing projects, there’s a chance that you’ll waste a lot of time tracking down this kind of name collision problem. I recommend that you implement local namespaces in each of your script files to avoid this.

Here’s how – Let’s say you create a script file called Foo.
Create a name space – like this.

Add your variables and functions and functions that you would normally have declared globally inside your namespace

You can add pseudo classes inside that too

Use it just like a library from other script files inside the same project.

and the result

For more like this, see Google Apps Scripts Snippets

Why not join our forum, follow the blog and or follow me on Twitter for more informations and updates