How can I update the block content programmatically? I have created a block plugin.
/src/Plugin/Block/Myblock
/**
 * Provides a 'Download component' block.
 *
 * @Block(
 *   id = &quot;my_custom_block&quot;,
 *   admin_label = @Translation(&quot;My custom block&quot;),
 * )
 */
class Myblock extends BlockBase {
  // Other code
}

The above block has a settings form also where I am uploading some files to the block.
I placed this block in two different regions on a page with different settings. (Uploaded different files)
Now I want to update the content of one of them i-e add a new file programmatically.
How will I do that? Because I can't load the block and update the field and save the block again because both returns me the same id my_custom_block.
$this-&gt;entityTypeManager-&gt;getStorage('block_content')-&gt;load('my_custom_block')); 

And also this returns me null.
Any idea how will I do that? Just like we update the nod entity, I want to update an instance of this block plugin.
Updated code:
I get the block like this
$node = \Drupal::routeMatch()-&gt;getParameter('node');
 if ($node instanceof \Drupal\node\NodeInterface) {
    /** @var \Drupal\layout_builder\Field\LayoutSectionItemList $layout */
    $layout = $node-&gt;get('layout_builder__layout');
    $block = $layout-&gt;getSection(0)-&gt;getComponent('1bb8e7b4-8253-40bc-a1f9-7f02e90edb2f')-&gt;getPlugin();
    $block-&gt;setConfigurationValue('file', ['6338, 6336']);
 }

Now how will I save the node using the block new configuration values?
I tried this.
 $node-&gt;get('layout_builder__layout')-&gt;getSection(0)-&gt;getComponent('1bb8e7b4-8253-40bc-a1f9-7f02e90edb2f')-&gt;setConfiguration($block-&gt;getConfiguration());
 $node-&gt;save();
Placed blocks are stored in the config entity block. The IDs are more or less unpredictable but you can load the blocks by specifying properties:
$entity_type_manager = \Drupal::entityTypeManager();
$blocks = $entity_type_manager-&gt;getStorage('block')-&gt;loadByProperties([
  'plugin' =&gt; 'my_custom_block',
  'region' =&gt; $region,
  'theme'  =&gt; $theme,
]);

A code example to load all blocks placed for the custom block plugin, do some checks and modify the settings:
$entity_type_manager = \Drupal::entityTypeManager();
$blocks = $entity_type_manager-&gt;getStorage('block')-&gt;loadByProperties([
  'plugin' =&gt; 'my_custom_block',
]);

foreach ($blocks as $block) {
  if ($block-&gt;getRegion() == 'my_region') {
    $settings = $block-&gt;get('settings');
    // modify settings
    $block-&gt;set('settings', $settings);
    $block-&gt;save();
  }
}