How to Call a Function from a Previous Workflow Step?

This topic was automatically generated from Slack. You can find the original thread here.

how do i call a function from a previous workflow step?

To call a function from a previous workflow step in Pipedream, you can access the data from the previous step using the pd.Steps object. The data from the previous step is available in the trigger map. Here’s an example in Go: go package main import ( "fmt" "[github.com/PipedreamHQ/pipedream-go](http://github.com/PipedreamHQ/pipedream-go)" ) func main() { // Access previous step data using pd.Steps fmt.Println(pd.Steps["trigger"]) } You can replace "trigger" with the name of the previous step you want to access. This allows you to share data between steps and compose new workflows.

how about in Python?

How would i call a function in my code from a previous workflow step (to my current step?)

How would i call a function in my code from a previous workflow step (to my current step?)
It is not possible for now. You can only reference the previous step result

Is this the same for custom classes/objects?

Is this the same for custom classes/objects?
I’m not sure what you mean by this.

If you want to reuse the function/classes/objects, you’ll need to publish it to a pypip/npm/go package, then import it to your step as libraries