List modules of current page

I am using modules plugin and trying to get the list of used modules for each page. I actually need each module’s name and the anchor. I was wondering if there is any way to easily get this info.

Any advice is greatly appreciated.

You should be able to get the name with $module->moduleName() and the anchor with $module->slug().

$page>modules() returns all modules.

Thanks a lot for your quick reply. I forgot to mention that I am trying to create a module and inside this module I want to get the list of used modules for each page. Is that even possible?