Skip to content

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

@spastorclovr

Description

@spastorclovr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions