I have custom module in which there is custom block and it's associated phtml which call my custom block functions using $block object.

I want to call other module block function in my custom module phtml

So I need to figure out the best way of doing it? I already have the idea how to call other block function in phtml through Objectmanager but it is not the best practice

Any help, knowledge and experience sharing would be appreciated

1 Answer 1


You Can Call Another Module Block Like This :-

$block = $this->getLayout()->createBlock('\Vendor\Module\Block\FileName')->yourFunction();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.