Skip to content

Commit 9baee14

Browse files
committed
register agent after creating unique_id and pos attributes
1 parent 447bf40 commit 9baee14

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mesa/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ def __init__(self, model: Model, *args, **kwargs) -> None:
6262
super().__init__(*args, **kwargs)
6363

6464
self.model: Model = model
65-
self.model.register_agent(self)
6665
self.unique_id: int = next(self._ids[model])
6766
self.pos: Position | None = None
67+
self.model.register_agent(self)
6868

6969
def remove(self) -> None:
7070
"""Remove and delete the agent from the model."""

0 commit comments

Comments
 (0)