Skip to content

Fix incorrect top-level imports causing artificial circular-import constraints #4727

@seanpearsonuk

Description

@seanpearsonuk

Hadn't noticed this previously. 👎

Originally posted by @seanpearsonuk in #4656

Body:

Several modules import PyFluent internals via the top-level package instead of their actual module paths, which creates unnecessary circular-import constraints.

Examples:

  • logger.py does:

    from ansys.fluent.core import config

    This re-enters __init__.py and forces the current “config must be imported before logging” ordering.
    It should import directly:

    from ansys.fluent.core.module_config import config
  • In other places, methods do:

    import ansys.fluent.core as pyfluent
    something = pyfluent.config.get_whatever()

    This is again using the top-level package as a proxy for internal modules, which tightly couples everything to __init__.py execution order.

Proposed fix:

  • Replace all top-level imports (from ansys.fluent.core import X or import ansys.fluent.core as pyfluent) with direct module imports (from ansys.fluent.core.module_config import config, etc.).
  • This eliminates the circular-import dance and removes the artificial ordering rule in __init__.py.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

2026 Q1 Jan - Mar

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions