# Passing a variable to other blocks

**URL:** <https://www.ruby-forum.com/t/passing-a-variable-to-other-blocks/237617>\
**Category:** GNU Radio\
**Created:** [November 21, 2013, 1:15pm UTC](https://www.ruby-forum.com/t/passing-a-variable-to-other-blocks/237617 "2013-11-21T13:15:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [November 21, 2013, 1:15pm UTC](https://www.ruby-forum.com/t/passing-a-variable-to-other-blocks/237617/1 "2013-11-21T13:15:30Z")

</div>

Hello Everyone

I was wondering how to pass a variable defined in one block to another.  
For instance, say we defined a variable in a block impl.cc, how can I  
pass  
this variable to another block? Or how can I make it public to be  
reached  
from every block in my flow graph?

I checked the variable block, but it defines it in the top\_block.py as I  
understood correctly.  
I’m trying to write my own blocks, and I gotta pass some of my variables  
to  
the others.  
What’s your advice?

Thanks in advance

Tarik

* * *

Aydin Tarik Zengin

---

<div class="post-metadata">

**Author:** ![Aydin\_Tarik\_Zengin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a88e57/32.png) [@Aydin\_Tarik\_Zengin](https://www.ruby-forum.com/u/Aydin_Tarik_Zengin)\
**Post date:** [November 21, 2013, 3:19pm UTC](https://www.ruby-forum.com/t/passing-a-variable-to-other-blocks/237617/2 "2013-11-21T15:19:22Z")

</div>

On Thu, Nov 21, 2013 at 7:13 AM, Aydin Tarik Zengin  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> the others.  
> What’s your advice?
> 
> Thanks in advance
> 
> Tarik

You’ll want to use the message passing interface for this:

[http://gnuradio.org/doc/doxygen/page\_msg\_passing.html](http://gnuradio.org/doc/doxygen/page_msg_passing.html)

Tom
