ERROR with system

Please, say why this error?
Estou usando system.db.runQuery().

system isn’t being imported correctly - where is your function “loadTags” being executed from?

Is this your problem? Using system.* inside a custom function?

Yes. Tank you.
But it do not works in windowOpened. Why?
How can I execute a function on windows opening?
My function is in root container.

is there a button that creates that window to open? If yes you can always use the scripting editor in that button to execute the script you want.