GNURadio OOT add custom function


Recently, I using gr_modtool to create my own block. I add a c++ block
in the .h file I add a function, but after compile it I cannot call my
function in python I just get error message “AttributeError: ‘(My
object has no attribute ‘(function)’”. I compare my code with other lot
code. I have no idea where the problem is, because I don’t feel like the
c++ code wrong. I guess is swig, but other code also not change anything
I got confused. What is going wrong?


Jeff Guo

Hi Jeff Guo,

did you add your function only to the lib/myblock_impl.{h,cc} or also to
include/myblock.h like this:

class MYMODULE_API my_block : public gr::block_type

virtual return_type myfunction(int argument0, char argument2…) =



Hi Jeff Guo,

please, always reply to the list instead of to people privately.
As a general rule: If your question is directly related to a previous
email, reply to that. If it’s a new topic, write a new email without
using the “reply” functionality of your mail client.’s “making an OOT module” tutorial covers general_block,
too. I always emphasize that as a beginner, you should only trust
tutorials from, since all other sources tend to outdate
without notice, and some contain plain wrong information.