Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute not found in module when using folder-based layout #507

Open
spastorclovr opened this issue Mar 6, 2025 · 1 comment
Open

Comments

@spastorclovr
Copy link

General Question

I am trying to use the layout described here https://www.kcl-lang.io/docs/reference/lang/codelab/collaborative

├── base
│   ├── backend.k
│   ├── exposer.k
│   ├── frontend.k
│   ├── kcl.mod
│   ├── kcl.mod.lock
│   └── main.k
├── dev
│   ├── backend.k
│   ├── frontend.k
│   ├── kcl.mod
│   ├── kcl.mod.lock
│   └── main.k

base/frontend.k is importing backend.k like so

import backend

and use some value like

 BACKEND_URL: "http://${backend.backend_app.metadata.name}"

Running from dev

kcl ../base/*.k *.k

will raise an error

   |
30 |           BACKEND_URL: "http://${backend.backend_app.metadata.name}"
   |                                  ^ attribute 'backend_app' not found in 'module 'backend''
   |

UNLESS I am importing backend from a file under the folder dev

I was wondering if this was the intended behaviour? If so, I am struggling in understand why?

Any help appreciated.

Thx

@spastorclovr
Copy link
Author

🤔 just realizing that if I do not import the modules because they are in the same folder, everything seems to work flawlessly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant