Skip to content

Accessing submodules #145

Open
Open

Description

@austin-hoover

Is there any reason not to allow access to Python submodules from the orbit module?

import orbit

bunch = orbit.core.Bunch()
lattice = orbit.teapot.TEAPOT_Lattice()
...

Currently we have to write:

from orbit.core.bunch import Bunch
from orbit.teapot import TEAPOT_Lattice
...

bunch = Bunch()
lattice = TEAPOT_Lattice()
...

Activity

  1. woodtp commented on Oct 9, 2026

    @woodtp
    Contributor

    Related issue #16

  2. woodtp commented on Oct 9, 2026

    @woodtp
    Contributor

    All this requires is the following lines in py/orbit/__init__.py

    from . import core
    from . import teapot

    And maybe py/orbit/core/__init__.py

    from .bunch import Bunch

    Thinking about it, it would kind of make sense to me to export Bunch and maybe other commonly used objects directly from the orbit module:

    from .core.bunch import Bunch

    Then you would be able to

    bunch = orbit.Bunch()
  3. austin-hoover commented on Oct 12, 2026

    @austin-hoover
    ContributorAuthor

    I made PR #158.

  4. austin-hoover commented on Oct 12, 2026

    @austin-hoover
    ContributorAuthor

    I agree that it would make sense to haveBunch accessible directly from orbit import, instead of orbit.core.bunch.Bunch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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