Python Module: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
(Created page with "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...")
 
No edit summary
Line 7: Line 7:


     a = 2
     a = 2
 
     def double(arg):
     def double(arg):
         return 2 * arg
         return 2 * arg

Revision as of 03:44, 29 December 2018

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.