My understanding is that every top-level variable in nim is global by default.
The {.global.} pragma has a different semantic, it's used to promote
locally-declared variables to the global scope/lifecycle (while restricting
their access to the local scope) so they are not discarded after the local
scope is discarded. There's a good example here:
[https://nim-lang.org/docs/manual.html#pragmas-global-pragma](https://nim-lang.org/docs/manual.html#pragmas-global-pragma)
It sounds like what you want is a {.threadvar.} instead:
[https://nim-lang.org/docs/manual.html#threads-threadvar-pragma](https://nim-lang.org/docs/manual.html#threads-threadvar-pragma)