This needs to be changed in drupal 8.9 and higher to: use Drush\Drush; Drush::output()->writeln($result. ' nodes '.$name.' imported.');