Hi T.K.

First you have enable the "Show All Block IDs" in GRC, then you can change
the ID of the block to whatever you want it to be.

In the snippet, then just refer to the block as self.blockname

Hope this helps.

Josh

On Wed, Sep 14, 2022 at 1:08 PM Temir Karakurum <temirkaraku...@gmail.com>
wrote:

> Hi,
>
> I have some python snippets within the GRC that refer to certain blocks.
> However, the GRC generated names can be quite unintuitive (like
> blocks_stream_to_vector_1_0 etc.) . I was wondering whether it is possible
> to refer to certain blocks by user-defined names.
>
> I understand that there is an alias option in each block's GUI that
> corresponds to a set_block_alias() call in the top_block python script.
> Apparently there is a block registry (
> https://github.com/gnuradio/gnuradio/blob/main/gnuradio-runtime/lib/block_registry.cc)
> that allows you lookups by alias but I could not figure out how to do that
> in python.
>
> What is the recommended approach for my scenario? Any help would be much
> appreciated.
>
> Best regards,
> T.K.
>
>
>

Reply via email to