Hello there! Is there a way to get the input name...
# beginners-need-help
m
Hello there! Is there a way to get the input name inside a node function? For example,
Copy code
node(func=melt_data, inputs="fcl_elevation")
...

def melt_data(df):
    # how to get "fcl_elevation" inside func?
d
Hi @Matheus Serpa !
So there are two ways I can think of doing this, but both acknowledging that we want to have pure python functions that have no ability to actually load/save outside of their scope
So the first approach is a hook
before_node_run
doesn't pass anything to the node, but you can often achieve the same goals
The other option is to partially apply your node
a
You can also do this using kwargs:
Copy code
def melt_data(**kwargs):
    print(kwargs)

node(f, inputs={"fcl_elevation": "fcl_elevation"}, None)
2 Views