Reputation: 11
I am trying to integrate a custom Python module (traffic_brain.py
) with my NetLogo model using the Python extension. The goal is to use Python functions defined in the module to enhance my NetLogo simulation. However, when I click the setup
button, I encounter the following error:
Extension exception: No module named 'traffic_brain'
error while observer running PY:RUN
called by procedure SETUP-PYTHON
called by procedure SETUP
called by Button 'setup'
Here is my setup in NetLogo:
to setup-python
; Initialize the Python extension
py:setup "python3"
; Add the module's directory to sys.path
py:run "import sys"
py:run "sys.path.append(r'./AI')"
; Import the custom Python module
py:run "import traffic_brain"
end
What could be causing NetLogo's Python extension to fail to import the traffic_brain
module, and how can I resolve this issue? Are there additional configurations or steps required to make custom Python modules accessible to the NetLogo Python extension?
Upvotes: 1
Views: 22