Call to undefined function drupal_execute() In a drupal8 module install file I have used drupal_execute() function like as follows

drupal_execute("content_copy_import_form", $form_state)


But this resulted in an error 


  Call to undefined function drupal_execute().


Any solution?
drupal_execute hasn't existed since Drupal 6.

In Drupal 8 you can submit a form programatically like this augmented example from ProgrammaticTest::submitForm:

$values = ['foo' =&gt; 'bar'];

// Programmatically submit the given values.
$form_state = (new FormState())-&gt;setValues($values);
\Drupal::formBuilder()-&gt;submitForm('\Drupal\form_test\Form\FormTestProgrammaticForm', $form_state);