Skip to content

Fix hex_ant: relative import error prevents example from running #357

@Harshini2411

Description

@Harshini2411

Describe the bug

The hex_ant example cannot be run due to a relative import error in app.py.

To Reproduce

  1. cd examples/hex_ant
  2. python app.py

Error

Traceback (most recent call last):
File "app.py", line 6, in
from .agent import AntState
ImportError: attempted relative import with no known parent package

Expected behavior

The example should run without errors.

Environment

  • Mesa version: 3.5.0
  • Python version: 3.x
  • OS: Windows

Possible fix

Replace relative imports with absolute imports, similar to how other working examples in the repo are structured.

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