import snakes.plugins
# snakes.plugins.load(['gv', 'hello'], 'snakes.nets', 'mynet')
from myplugin import hello1
snakes.plugins.load(['gv', 'hello1'], 'snakes.nets', 'mynet')
from mynet import *
n = PetriNet('N')
n.hello()
Output: with standard hello plugin import
> Hello from N
Output: with local hello1 plugin import
I tried couple of imports (relative/absolute), but I couldn't understand where the load function searches for plugin modules "snakes.plugins.load "
Error
File "snakes-plugin-test.py", line 4, in <module>
snakes.plugins.load(['gv', 'hello1'], 'snakes.nets', 'mynet')
File "[...].venv/lib/python3.8/site-packages/snakes/plugins/__init__.py", line 103, in load
plug = __import__(plug, fromlist=["__name__"])
ModuleNotFoundError: No module named 'snakes.plugins.hello1'
Quick fix
I created a symbolic link of my hello1.py into [...].venv/lib/python3.8/site-packages/snakes/plugins/
Question - Help Needed
How to correctly import local plugin modules?
Project Folder
. ├── myplugin │ ├── pycache │ │ └── hello1.cpython-37.pyc │ └── hello1.py ├── Pipfile └── snakes-plugin-test.py
snakes-test.py
Output: with standard hello plugin import
> Hello from N
Output: with local hello1 plugin import
I tried couple of imports (relative/absolute), but I couldn't understand where the load function searches for plugin modules "snakes.plugins.load "
Error
Quick fix
I created a symbolic link of my hello1.py into [...].venv/lib/python3.8/site-packages/snakes/plugins/
ln -rs hello1.py .venv/lib/python3.8/site-packages/snakes/plugins/hello1.py
Now it works, but I assume there must be another way to import locally developed plugins.