How to programmatically import a feed? I'm using Drupal 8 and creating a feed entity like this:

//...    
$feed = \Drupal::entityTypeManager()-&gt;getStorage('feeds_feed')-&gt;create(array(
            'type' =&gt; 'my_feed',
            'uuid' =&gt; \Drupal::service('uuid')-&gt;generate(),
            'title' =&gt; 'RSS feed',
            'uid' =&gt; $uid,
            'status' =&gt; 1,
            'created' =&gt; time(),
            'source' =&gt; $form_state-&gt;getValue('rss_feed_url'),
          ));
$feed-&gt;save();
//...  


That works fine!
But how can I execute the import after saving the new feed entity?
I've tried the following:

// Batch starts and returns "This webpage has a redirect loop" 
$feed-&gt;startBatchImport();

// Returns an error: "Call to undefined method Drupal\feeds\FeedImportHandler::startCronImport()"
$feed-&gt;startCronImport();


How can I import the feed items after creating the feed entity?
This is working for me. Note: You will need to know the numerical $id of your Feed from the D8 DB table feeds_feed. In my case it is 1 so $id = 1.

use Drupal\feeds\Entity\Feed;

function mymodule_cron() {

  /**
   * Runs single feeds on cron
   */

  $feed = Feed::load($id);
  if (!$feed-&gt;isLocked()) {
    $queue = \Drupal::queue('feeds_feed_import:' . $feed-&gt;bundle());
    if ($queue-&gt;createItem($feed)) {
      // Add timestamp to avoid queueing item more than once.
      $feed-&gt;setQueuedTime(REQUEST_TIME);
      $feed-&gt;save();
    }
  }
}