如何在仪表板中加载模块的变量

I am using pyroCMS and i have module A and in that i have a controller, I am getting some values in $var which i defined in function index(), How to load the controller in a different module, I have to use the variable in the controller in my dashboard view

Here is my controller code in module A

public function index()
{
$data = $this->recent();
}

dashboard.php view file

<div class="accordion-body collapse in lst" style="overflow: auto;">
<?php print_r($data );?>
</div>
I am not getting $data in dashboard.php

According to the documentation, it should be something like this:

public function index()
{
    $data = $this->recent();
    $this->template
        ->set('data', $data)
        ->build('dashboard');
}

Edit:

To have a module load data when a user visits the dashboard you need to use events. The following hook should be called when loading the dashboard.

Events::register('admin_controller', array($this, 'run'));