I am writing a plugin for my nomad-oasis in which I want to reference a section from one shema package in another schema. My repository looks similar this:
nomad-example
├── src
│ ├── nomad_example
│ │ ├── schema_packages
│ │ │ ├── __init__.py
│ │ │ ├── mypackage1.py
│ │ │ ├── mypackage2.py
├── LICENSE.txt
├── README.md
└── pyproject.toml
mypackage1 has a section section1:
class section1(Schema):
m_def = Section(
label='section1',
categories=[ToolsCategory],
a_eln=ELNAnnotation(),
)
which I try to reference in schemapackage2 like this:
section1_ref = Quantity(
type=SectionProxy('schemapackage1.section1'),
a_eln=ELNAnnotation(
component=ELNComponentEnum.ReferenceEditQuantity,
),
)
I have tried all variations of ‘section1.m_def’, ‘schema_packages.schemapackage1.section1’, ‘nomad_example.schema_packages.schemapackage1.section1’, … as well as using Reference(…) or Reference(SectionProxy(…)).
When running run my oasis without the refernece, all works well. With the reference-quantity however, I get an Error.
In the tutorial it says “The strings given to SectionProxy
are paths within the available definitions. [This] works, if [section1
] is eventually defined in the same package.”
Is mypackge2 not in the same package or am I doing something else wrong?