Using Custom Python Scripts in Knime

Hi All,

I am new to KNIME and was wondering if anyone knew the best way to go about importing custom python scripts into KNIME? I have a bunch of external modules and I would like to be able to import them so that I can access various objects, functions, classes, etc. The modules are a part of a larger system and are dependent on each other. 

 

Thanks!

Hi,

you can add the folders containing the modules and then import them like it is shown in the following snippet:

import sys
sys.path.append('/home/user1/customPythonModules')
import customModule1

I hope this helps you.

Cheers,

Patrick

3 Likes

Although it’s been answered (winter’s solution), I’d like to ask for the sake of searching and finding:
why wouldn’t os.chdir(work_dir) work just like sys.path did?
Cheers all!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.