Python Module: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:Block Docs]] | |||
This block lets you embed a python module in your flowgraph. | This block lets you embed a python module in your flowgraph. | ||
Line 16: | Line 17: | ||
to set parameters of other blocks in your flowgraph. | to set parameters of other blocks in your flowgraph. | ||
Note that your custom imports will occur at the very beginning of the flowgraph's Python script, along with the other imports, so the module won't know about any parameters passed in (e.g. via command line args). |
Revision as of 22:20, 12 March 2019
This block lets you embed a python module in your flowgraph.
Code you put in this module is accessible in other blocks using the ID of this block. Example:
If you put
a = 2 def double(arg): return 2 * arg
in a Python Module Block with the ID 'stuff' you can use code like
stuff.a # evals to 2 stuff.double(3) # evals to 6
to set parameters of other blocks in your flowgraph.
Note that your custom imports will occur at the very beginning of the flowgraph's Python script, along with the other imports, so the module won't know about any parameters passed in (e.g. via command line args).