Oops, I forgot to mention how to reference a query that is called from inside a tcl procedure.
Its the same syntax. The element before the query name is the proc name.
dbqd.notes.tcl.notes-procs.proc_name.get_note
If the proc has a namespace definied, the full proc name is used.
dbqd.notes.tcl.notes-procs.ns::proc_name.get_note
I also made an error. If a query file is under the www page root the query path is dbqd.www.filename.queryname
If the query is under a package the path is dbqd.package-key.package-key-procs.proc_name.query_name
Sorry about the mixup!