I have a question about running Python scripts in OmniGraph

Can I enter values from the OmniGraph into code that is executed in Script Node? And can I output the return value of the code outside the Script Node?
I would like to use the code I have already created, but the if statements are complicated and I don’t want to replace them with Nodes.

you can get and set attributes of any omnigraph nodes by calling

og.Controller.attribute("/action_graph/new_node_name.inputs:value").set("new value")
# and .get()

here’s the tutorial page about it.

Thank you very much!