Constant Relative Imports #942
              
                Unanswered
              
          
                  
                    
                      rohan-datar
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 1 comment 9 replies
-
| 
         I think you are looking for sibling imports? See this post here: #902 (reply in thread)  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    9 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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
templateand another template that depends on
foo.pklThen I have a package
Configuratorthat 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.pklis 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 theimportexpression, which breaks the template in unexpected ways becausefoois then instantiated as an empty module.Is there a better solution for this?
Beta Was this translation helpful? Give feedback.
All reactions