Skip to content

Any way to access the current module's name or URI reflectively? #336

Answered by bioball
raystubbs asked this question in Q&A
Discussion options

You must be logged in to vote

You can get this through the reflection API:

import "pkl:reflect"

local mod = reflect.Module(module)

moduleName = mod.name

moduleUri = mod.uri

More docs on the reflect API: https://pkl-lang.org/package-docs/pkl/current/reflect/index.html

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@raystubbs
Comment options

Answer selected by holzensp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants