Skip to main content
Question

How can we integrate a custom python project into FME workbench?

  • October 26, 2023
  • 1 reply
  • 17 views

I am currently struggling to find detailed documentation on how we can add a custom project to FME, and simply use it with PythonCaller's, if anyone knows of a good guide for reference it will be much appreciated.

1 reply

david_r
Celebrity
  • October 26, 2023

Depends on the Python project and how it's structured, but in principle you could simply import the main module into the PythonCaller and call whatever method needed there. Example

import fmeobjects
import my_custom_python_project
 
def FeatureProcessor(feature):
    my_attribute_value = feature.getAttribute('my_fme_attribute')
    my_custom_python_project.main(my_attribute_value)

This would call my_custom_python_project.main() with the value from the FME attribute 'my_attribute_value' as parameter. In some instances you may have to ensure that my_custom_python_project is on the PythonPath before importing.

If you need further integration between FME and the custom Python code, this is a good starting point: https://community.safe.com/s/article/python-and-fme-basics


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings