If the block that you're trying to instantiate is defined in the layout then first you need to inject an instance of \Magento\Framework\View\Result\PageFactory
.
Helper Class
...
protected $_resultPageFactory;
...
public function __construct(
...
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
...
) {
...
$this->_resultPageFactory = $resultPageFactory;
...
}
Then you can instantiate your block using its name from the layout.
$resultPage = $this->_resultPageFactory->create();
$blockInstance = $resultPage->getLayout()->getBlock('category.products.list');
If the block that you're trying to instantiate is not defined in the layout then first you need to inject an instance of \Magento\Framework\View\LayoutFactory
.
Helper Class
...
protected $_layoutFactory;
...
public function __construct(
...
\Magento\Framework\View\LayoutFactory $layoutFactory,
...
) {
...
$this->_layoutFactory = $layoutFactory;
...
}
Then you can instantiate your block using this layout factory.
$this->_layoutFactory->create()->createBlock('Magento\Catalog\Block\Product\ListProduct');