As @stisa mentioned above, runtime imports are not really possible in Nim because Nim is not an interpreted language. Runtime imports are possible in a language like Python because the CPython VM can stop execution in a scope to import a module. Nim, however, pulls in modules at compile time. Once Nim code is compiled into an executable binary, there is no way to include a module without recompiling. The `when` conditional above is like an if statement that runs at compile time. Therefore, it is capable of conditionally importing modules.
In addition to @stisa's comments regarding qualified module name resolution: In most cases there is actually no need for namespaced modules as demonstrated because Nim performs function resolution based on a function's type signature. Very rarely are there two separate functions in 2 separate modules that are named the exact same thing, take the exact same arguments, and return the exact same value.