magento2.4.1 – Call third party module block function to custom module block – Error: Call to a member function getAttributes() on null

Third party module Block:

Path: appcodeAmastyStorelocatorBlockViewAttributes.php

<?php
/**
 * @author Amasty Team
 * @copyright Copyright (c) 2021 Amasty (https://www.amasty.com)
 * @package Amasty_Storelocator
 */


namespace AmastyStorelocatorBlockView;

use MagentoFrameworkViewElementTemplate;

/**
 * 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 ZendLogWriterStream(BP . '/var/log/log1.log');
               $logger = new ZendLogLogger();
               $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 : appcodeZeroStorelocatorBlockCustomerreview.php

<?php
namespace ZeroStorelocatorBlock;
use AmastyStorelocatorModelConfigProvider;


class Customerreview extends MagentoFrameworkViewElementTemplate
{
     protected $helper;
     protected $_amastyconfigProvider;

        
     public function __construct(        
        AmastyStorelocatorBlockviewAttributes $attributes,
        MagentoFrameworkViewElementTemplateContext $context,
        MagentoFrameworkAppConfigScopeConfigInterface $scopeConfig,
        AmastyStorelocatorBlockViewAttributes $myValue,
        AmastyStorelocatorBlockViewLocation $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', MagentoStoreModelScopeInterface::SCOPE_STORE);
        
        $accountId = $this->scopeConfig->getValue('customerreview/general/review_account_id', MagentoStoreModelScopeInterface::SCOPE_STORE);

         // try to print values from third party module
         $writer = new ZendLogWriterStream(BP . '/var/log/fin.log');
         $logger = new ZendLogLogger();
         $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 getting following error:

Error: Call to a member function getAttributes() on null in C:xampphtdocsm3appcodeAmastyStorelocatorBlockViewAttributes.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?