Third party module Block: Path: **app\code\Amasty\Storelocator\Block\View\Attributes.php** <?php /** * @author Amasty Team * @copyright Copyright (c) 2021 Amasty (https://www.amasty.com) * @package Amasty_Storelocator */ namespace Amasty\Storelocator\Block\View; use Magento\Framework\View\Element\Template; /** * Class Attributes */ class Attributes extends Template { /** * Show attributes * * @return string */ public function toHtml() { if (!$this->getLocationAttributes()) { return ''; } return parent::toHtml(); } public function getLocationAttributes() { //logger $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/log1.log'); $logger = new \Zend\Log\Logger(); $logger->addWriter($writer); $logger->info($this->getLocation()->getAttributes()); return $this->getLocation()->getAttributes(); } } log file return values Try to call **getLocationAttributes()** in my custom module, Path : **app\code\Zero\Storelocator\Block\Customerreview.php** <?php namespace Zero\Storelocator\Block; use Amasty\Storelocator\Model\ConfigProvider; class Customerreview extends \Magento\Framework\View\Element\Template { protected $helper; protected $_amastyconfigProvider; public function __construct( \Amasty\Storelocator\Block\view\Attributes $attributes, \Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Amasty\Storelocator\Block\View\Attributes $myValue, \Amasty\Storelocator\Block\View\Location $myValue1, ConfigProvider $amastyConfigProvider, array $data = [] ) { $this->_attributes = $attributes; $this->scopeConfig = $scopeConfig; $this->_amastyconfigProvider = $amastyConfigProvider; parent::__construct($context, $data); } protected function _prepareLayout() { parent::_prepareLayout(); } public function getCustomerReview(){ $authentication = $this->scopeConfig->getValue('customerreview/general/review_auth', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); $accountId = $this->scopeConfig->getValue('customerreview/general/review_account_id', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); // try to print values from third party mdule $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/fin.log'); $logger = new \Zend\Log\Logger(); $logger->addWriter($writer); $logger->info(print_r($this->_attributes->getLocationAttributes())); // print the values $authorization = "Authorization:".$authentication; $url = 'https://mybusiness.googleapis.com/v4/accounts/'.$accountId.'/locations/123456789/reviews'; $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization )); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $output = curl_exec($ch); $allData = json_decode($output, TRUE); // You will get all the data return $allData; } } I am following error: Error: Call to a member function getAttributes() on null in C:\xampp\htdocs\m3\app\code\Amasty\Storelocator\Block\View\Attributes.php:39 39th line -> $logger->info($this->getLocation()->getAttributes()); How to solve this error, i want to get my third party module function values to my custom module?