From Drush 9 and higher drush commands are symfony services, so you can load them as other services though the services container. example:
if (PHP_SAPI === 'cli') { $command = \Drupal::service('migrate_tools.commands'); $command->import('my_migration', ['update' => TRUE, 'sync' => TRUE]); }