A workaround is to put the files in the “site-packages” folder of the Python environment since this folder is in the pythonpath in KNIME but I would like to have a better solution.
your right, putting the scripts in the “sites-packages” folder would work, but its not the most elegant solution.
Another thing that could work and is similarly non-elegant would be to put the scripts into the workflow folder, which is the also the working directory of python. This is nice as it makes your workflow portable, but I think you aim at storing the scripts rather more centrally, right?
A way for you could be to use a startup script to set the path there before python starts. This would be the “manual” option in the preferences page, an example can be found in the docs, under “Option 2: Manual”, the second choice.
It might even work to put the start script (or the export PYTHONPATH=${PYTHONPATH}:/path/to/my/scripts) in the .bashrc of the machine of the executor, since the start script is executed via bash anyways - but you’d need to try that, I haven’t tested.
Hi Lukas,
I already tried the .bashrc way with no success (see my first post).
But after a second glance at the pythonpath output in KNIME I saw that the “workflow_directory” (the parent folder of the actual workflows) is in the python path. So I put my python files to this place and removed them from the “site-packages” and it works as expected.