If I properly understood what you want - you can do that with this macro:
( might not be the best approach, it's literally my first ever macro =D )
import macros
macro importVar(filename, varname: static string): untyped =
result = newStmtList()
result.add nnkFromStmt.newTree(
newIdentNode(filename),
newIdentNode(varname)
)
const pathsFile = "./paths.nim"
const varname = "hello"
importVar(pathsFile, varname)
echo hello # Hello, Antonio!
Run
# ./paths.nim
const hello* = "Hello, Antonio!"
Run
