Skip to content

Debugging and Best Practices

Phorb edited this page Aug 5, 2025 · 1 revision

Best practices

Importing Game for type checking

Importing from eggsplode.core in the card modules will cause cyclic imports issues. If you need to import the Game class for type checking, use conditioned import:

❌ Don't do this:

from eggsplode.core import Game

def func(game: Game):
    ...

✅ Do this instead:

from typing import TYPE_CHECKING
if TYPE_CHECKING:
    from eggsplode.core import Game

# Don't forget the double quotes around "Game"!
def func(game: "Game"):
    ...

Clone this wiki locally