Skip to main content

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.

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


Reply