arnauorriols / node-red-contrib-python-function

Write Python functions in Node-RED!
MIT License
41 stars 23 forks source link

Importing other .py files #3

Closed krambriw closed 3 years ago

krambriw commented 7 years ago

This is a cool node, been looking for something like this,

Running Node-RED on a RPi. Do you know "how to" or where to put additional .py files to import into the node. Like mosquitto.py

Currently the following fails

import mosquitto.py with error Traceback (most recent call last): File "", line 101, in File "", line 59, in python_function ImportError: No module named mosquitto.py

as well as

import /home/pi/mosquitto.py with error File "", line 60 import /home/pi/mosquitto.py ^ SyntaxError: invalid syntax

sorscode commented 6 years ago

Two years old, but I'll respond

import sys sys.path.append('/path/to/your/module') import custom_module