If you are looking for global variables defined inside procs you can use the {.global.} pragma:
proc singleton(): string =
var witness {.global.}: bool
if witness:
result = "Kilroy was here"
else:
result = "First time initialization"
witness = true
when isMainModule:
for f in 0..5: echo singleton()