Start node-red on boot doesn't find python module in exec node


I am retrieving values from S7 PLC and passing it as json string argument to a python script.
I'm using the exec node to exec the .py script

When I launched node-red manually, everything works but when I enable node-red to start automatically on boot, I got python error that no module named found.
I tried to add the export PYTHONPATH=$PYTHONPATH:/path/to/module in the bash script and then exec my python script but still got this error.

Do you have any idea?

Best regards

  1. what platform and os? i.e RPI running stretch or macOS v 10.13.6?

  2. what version of NR, node.js? (get from log at startup)?

  3. what is the exact error and where do you see it?

  4. what else is in the flow? (an image of the flow is ok, a copy of the flow is better but read this thread before you post it: How to share code or flow json)

can you fully path the call to python (in your script) ? - /usr/bin/python....
as well as setting the PYTHONPATH. And maybe also cd into the dir where the .py script is before calling ?

cd ~/mydir/
export PYTHONPATH=....