Find if widget block is active

One could e.g. get the widget blocks data with:

$widget_blocks = get_option( 'widget_block' );

and then loop through the array and run has_block() on the contant part, e.g. like (untested):

function is_active_block_widget_wpse( $blockname )
    $widget_blocks = get_option( 'widget_block' );
    foreach( (array) $widget_blocks as $widget_block ) {
        if ( ! empty( $widget_block['content'] ) 
             && has_block( $blockname, $widget_block['content'] ) 
        ) {
            return true;
        }
    }
    return false;
}

to find if a given blockname is an active widget:

is_active_block_widget_wpse( 'my-plugin/my-block' )

We note that this simple implementation assumes none inactive block widgets.

Other helpful functions: wp_get_sidebars_widgets() and is_active_widget()

error code: 523