Hierarchical access to a coverpoint from interface

I’m trying to hierarchically access a coverpoint defined in a uvm_subscriber from an interface.

I want to do something like the following:

coverage_value = coverage_uvm_subscriber_class.my_covergroup.my_coverpoint.get_coverage();

Where “coverage_value” is a real variable in an interface which stores coverage.

Is this way of accessing coverpoints in a class from an interface legal in SystemVerilog?

In reply to Khaled Ismail:

This should work as long as you have access to the class type of coverage_uvm_subscriber_class from the package it is defined in and you can get a handle to the component created by your environment.