Constant Relative Imports #942
Unanswered
rohan-datar
asked this question in
Q&A
Replies: 1 comment 3 replies
-
I think you are looking for sibling imports? See this post here: #902 (reply in thread) |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This probably is a relatively niche issue, so I understand if what I'm trying to do here isn't possible in pkl, but I thought I'd ask the question anyway.
I'm trying to build a relatively complex template, and as a result some template files rely on information contained in other ones. Here's a minimal example:
In package
template
and another template that depends on
foo.pkl
Then I have a package
Configurator
that depends ontemplate
.where the templates are filled out like this:
This works fine, but I am in a situation where the could be hundreds of different configurations and putting
foo = import("./foo.pkl")
inside every singlebar.pkl
is very inconvenient.Is there a way I can create a relative import (or something else that allows me to access the contents of
foo.pkl
) in the parent template? I can enforce the relative path of the configuration files within each instance of the template, but it is easy for a user to forget theimport
expression, which breaks the template in unexpected ways becausefoo
is then instantiated as an empty module.Is there a better solution for this?
Beta Was this translation helpful? Give feedback.
All reactions