Skip to content

How to compose a collection from elements defined in other files #838

Answered by HT154
ekille-foreflight asked this question in Q&A
Discussion options

You must be logged in to vote

This is very close as-is! The only difference is that civic.pkl must amend Car.pkl instead of importing it. Amending a module is conceptually identical to instantiating it via new

civic.pkl

amends "Car.pkl"

name = "Civic EX"
year = "1997"

Separately, the Inventory class in your Inventory.pkl module seems odd. The class appears unused and duplicate the module's existing properties. You can likely remove the class entirely. In Pkl, modules are classes.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ekille-foreflight
Comment options

Answer selected by ekille-foreflight
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