Hub
Pricing About
WorkflowWorkflow

Propagate Python Functions Downstream

PythonPythonPickle
potts profile image
Draft Latest edits on 
Feb 21, 2020 11:51 PM
Drag & drop
Like
Download workflow
Workflow preview
Defining a Python function inside a single Python node means that function is only available inside that node. To create reusable code, your best option is to create a regular Python module, then import that module into each node where you want to use it. Creating a Python module can be surprisingly easy: put your Python functions inside a text file and save it with the file extension ‘.py’. But what if you are never, ever going to use your Python function again except inside this one Workflow? It might feel like overkill to create a Python module if it only has one place where it ever gets used. You could always copy+paste the function definition into each Python node, but this quickly feels less than ideal. This workflow demonstrates how a Python function can be defined in one node, then passed along to other Python nodes via a flow variable. If more than one function needs to be propagated along, create another flow variable to hold each function.
Loading deploymentsLoading ad hoc jobs

Used extensions & nodes

Created with KNIME Analytics Platform version 4.1.0
  • Go to item
    KNIME CoreTrusted extension

    KNIME AG, Zurich, Switzerland

    Version 4.1.0

    knime
  • Go to item
    KNIME Python Integration

    KNIME AG, Zurich, Switzerland

    Version 4.1.0

    knime

Legal

By using or downloading the workflow, you agree to our terms and conditions.

KNIME
Open for Innovation

KNIME AG
Talacker 50
8001 Zurich, Switzerland
  • Software
  • Getting started
  • Documentation
  • Courses + Certification
  • Solutions
  • KNIME Hub
  • KNIME Forum
  • Blog
  • Events
  • Partner
  • Developers
  • KNIME Home
  • Careers
  • Contact us
Download KNIME Analytics Platform Read more about KNIME Business Hub
© 2025 KNIME AG. All rights reserved.
  • Trademarks
  • Imprint
  • Privacy
  • Terms & Conditions
  • Data Processing Agreement
  • Credits