Hi, I am using the "Embedded Python Block" to create a simple controller that controls my USRP Source/Sink blocks. These blocks support a message interface but unfortunately this is pretty useless except for the simplest applications (I need to control advanced tuning with timed commands, GPIO ports etc).
Hence I need to call the methods of these objects directly but I need a reference to them inside my custom block. Within my python block I cannot reference the parent blocks, hence I need to pass a reference to these two objects via the constructor (and parameters). Basically I want to do the same as parameter "Block ID" from the block "Function Probe" does. What is the best way to implement this? Thanks, Luke PS: Example: class blk(gr.sync_block): # other base classes are basic_block, decim_block, interp_block def __init__(self, sample_rate=1.0, usrp_source_block=''): # only default arguments here """arguments to this function show up as parameters in GRC""" gr.sync_block.__init__( self, name='Controller', # will show up in GRC in_sig=[np.float32], out_sig=[np.float32] ) # if an attribute with the same name as a parameter is found, # a callback is registered (properties work, too). self.sample_rate = sample_rate self.usrp_source_block = usrp_source_block # here I want to execute for example self.usrp_source_block.set_gain(5.0) When I then create an USRP Sink object with ID uhd_usrp_sink_0 and enter as parameter I get the error: Param - Usrp Source Block(usrp_source_block): Value "uhd_usrp_sink_0" cannot be evaluated: name 'uhd_usrp_sink_0' is not defined