# GNURadio OOT add custom function

**URL:** <https://www.ruby-forum.com/t/gnuradio-oot-add-custom-function/231322>\
**Category:** GNU Radio\
**Created:** [August 3, 2014, 8:27am UTC](https://www.ruby-forum.com/t/gnuradio-oot-add-custom-function/231322 "2014-08-03T08:27:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [August 3, 2014, 8:27am UTC](https://www.ruby-forum.com/t/gnuradio-oot-add-custom-function/231322/1 "2014-08-03T08:27:18Z")

</div>

Hello,

Recently, I using gr\_modtool to create my own block. I add a c++ block  
and  
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  
blocks)’  
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  
so  
I got confused. What is going wrong?

Thanks

Jeff Guo

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 3, 2014, 10:39am UTC](https://www.ruby-forum.com/t/gnuradio-oot-add-custom-function/231322/2 "2014-08-03T10:39:57Z")

</div>

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…) =  
0;  
…  
};

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 5, 2014, 2:03am UTC](https://www.ruby-forum.com/t/gnuradio-oot-add-custom-function/231322/3 "2014-08-05T02:03:17Z")

</div>

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.

[www.gnuradio.org](http://www.gnuradio.org)’s “making an OOT module” tutorial covers general\_block,  
too. I always emphasize that as a beginner, you should only trust  
tutorials from [gnuradio.org](http://gnuradio.org), since all other sources tend to outdate  
without notice, and some contain plain wrong information.

Greetings,  
Marcus
