Loading block via ajax
You can use the #ajax attribute to load main part of the block via Drupal ajax.

namespace Drupal\generator\Plugin\Block;

use Drupal\Core\Block\BlockBase;
use Drupal\generator\Form\ProjektForm;

class GeneratorBlock extends BlockBase {

  public function build() {
    return array(
      'form_wrapper' =&gt; array(
        '#prefix' =&gt; '&lt;div id="form-wrapper"&gt;',
        '#suffix' =&gt; '&lt;/div&gt;',
        '#markup' =&gt; '',
      ),
      'load_form' =&gt; array(
        '#type' =&gt; 'button',
        '#value' =&gt; $this-&gt;t('Load form'),
        '#ajax' =&gt; array(
          'wrapper' =&gt; 'form-wrapper',
          'callback' =&gt; array(static::class, 'getForm'),
        ),
      ),
      '#attached' =&gt; array(
        'library' =&gt;  array(
          'generator/generator-css'
        ),
      ),
    );
  }

  public static function getForm() {
    return \Drupal::formBuilder()-&gt;getForm(ProjektForm::class);
  }

}