Print search field in template file
One way is to preprocess the menu and inject it as a variable, then print the variable:

use Drupal\block\Entity\Block;

/**
 * Implements hook_preprocess_menu().
 */
function mytheme_preprocess_menu(&amp;$variables) {
  $block = Block::load('myblock');
  $variables['myblock'] = \Drupal::entityTypeManager()-&gt;getViewBuilder('block')-&gt;view($block);
}


Then in your template:

{{ myblock }}