Would it be possible to create a script in one PythonCaller with a number of functions, and then call the functions in that script from another PythonCaller using the 'from <script_name> import <function_name>' syntax?
Solved
Within one PythonCaller script, are you able to call functions defined in other PythonCaller scripts in the FME workbench ?
Best answer by david_r
Yes, you can, but not exactly as you propose. For example, you can import modules that are saved in the same directory as your workspace file. This works because FME automatically adds the current workspace directory to the PythonPath when the workspace is running. This is also mentioned in the log.
Since the entire workspace is using the same Python interpreter, it is also possible to reference objects between different PythonCallers, but there are some potential pitfalls so this is something that I always try to avoid.
But as an example, you can define a global variable in the startup script and retrieve the value in e.g. a PythonCaller later on.
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

