# GRC: set order of block instantiations

**URL:** <https://www.ruby-forum.com/t/grc-set-order-of-block-instantiations/223632>\
**Category:** GNU Radio\
**Created:** [October 11, 2012, 9:04pm UTC](https://www.ruby-forum.com/t/grc-set-order-of-block-instantiations/223632 "2012-10-11T21:04:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [October 11, 2012, 9:04pm UTC](https://www.ruby-forum.com/t/grc-set-order-of-block-instantiations/223632/1 "2012-10-11T21:04:40Z")

</div>

Hi list,

is there a way to set the order of block instantiations in GNU Radio  
companion?  
The reason I am asking is, that I want to pass one block as a parameter  
to another block to get access to its methods. Is there an easier way to  
do this?

Somehow related: Variables configured in GRC are defined before the  
block instantiations. Is it possible to tell GRC where in the final  
python script a variable should be defined?

Best regards

Gerald

---

<div class="post-metadata">

**Author:** ![gerald\_b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b2d939/32.png) [@gerald\_b](https://www.ruby-forum.com/u/gerald_b)\
**Post date:** [October 13, 2012, 3:40am UTC](https://www.ruby-forum.com/t/grc-set-order-of-block-instantiations/223632/2 "2012-10-13T03:40:01Z")

</div>

On 10/11/2012 12:03 PM, Gerald B. wrote:

> Hi list,
> 
> is there a way to set the order of block instantiations in GNU Radio  
> companion?  
> The reason I am asking is, that I want to pass one block as a parameter  
> to another block to get access to its methods. Is there an easier way to  
> do this?

I think the order is either 1) alphabetical or 2) the z dimension of the  
blocks in the flowgrah.

> Somehow related: Variables configured in GRC are defined before the  
> block instantiations. Is it possible to tell GRC where in the final  
> python script a variable should be defined?

The variable blocks are sorted by order of dependency amongst each  
other.

-josh

---

<div class="post-metadata">

**Author:** ![gerald\_b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b2d939/32.png) [@gerald\_b](https://www.ruby-forum.com/u/gerald_b)\
**Post date:** [October 15, 2012, 9:11pm UTC](https://www.ruby-forum.com/t/grc-set-order-of-block-instantiations/223632/3 "2012-10-15T21:11:07Z")

</div>

On 11.10.2012 21:03, Gerald B. wrote:

> is there a way to set the order of block instantiations in GNU Radio  
> companion?  
> The reason I am asking is, that I want to pass one block as a parameter  
> to another block to get access to its methods. Is there an easier way to  
> do this?  
> Just for future reference, I found out that, at least for my purposes,  
> there already exists an elegant way to access a block’s methods. It is  
> possible to define a “function probe” in GNU Radio companion which  
> periodically calls a block’s method and saves the result as a variable.

Best regards

Gerald

---

<div class="post-metadata">

**Author:** ![gerald\_b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b2d939/32.png) [@gerald\_b](https://www.ruby-forum.com/u/gerald_b)\
**Post date:** [October 15, 2012, 9:45pm UTC](https://www.ruby-forum.com/t/grc-set-order-of-block-instantiations/223632/4 "2012-10-15T21:45:00Z")

</div>

On 10/15/2012 12:10 PM, Gerald B. wrote:

> On 11.10.2012 21:03, Gerald B. wrote:
> 
> > is there a way to set the order of block instantiations in GNU Radio  
> > companion?  
> > The reason I am asking is, that I want to pass one block as a parameter  
> > to another block to get access to its methods. Is there an easier way to  
> > do this?  
> > Just for future reference, I found out that, at least for my purposes,  
> > there already exists an elegant way to access a block’s methods. It is  
> > possible to define a “function probe” in GNU Radio companion which  
> > periodically calls a block’s method and saves the result as a variable.

Sorry, should have mentioned that too!

Function probe gets around this by having a try/catch in its loop so the  
block to be probed doesnt have to yet be instantiated when the thread  
starts.

-josh
