Permit creation record only from parent subpanel

Goodmorning, Is there a possibility to avoid the creation of record for a specific modules from all parts execpt from parent subpanel?

In my case, I have a module A that has a subpanel with module B (in module B I have relatedfield) and I would like to create records of module B just from subpanel in module A and avoid to create records using button in sidebar.

Someone has the same needed?

B.

@bf.ts90
Edit file:
modules/<module_B>/Menu.php