App module name collide with other apps

I have two apps A and B which both have a module named XYZ inside them. when I install them I got the following error:

('Module Def', 'XYZ', IntegrityError(1062, "Duplicate entry 'XYZ' for key 'PRIMARY'"))

It seems like if the module name needs to be unique for the whole platform. Debugging a bit I found code on file frappe/frappe/ line 290 version 12

def add_module_defs(app):
	modules = frappe.get_module_list(app)
	for module in modules:
		d = frappe.new_doc("Module Def")
		d.app_name = app
		d.module_name = module

There is something I’m missing here or indeed the modules need to be unique for the whole platform?

The Module name needs to be unique per frappe site
If you are installing app A on site A and app B on site B there should not be an issue

Thanks for your reply @Mohammad_Hasnain the main reason is that there is no reason at all, or say in other words there is no known restriction, at least I could not find any on the official doc or any other doc.

I think that this can be an issue given that any other developer could choose to use the same name as me for his module. In our case, we tried to organize our app’s modules so each app has a core module for better onboarding developers and DX

I also think that it’s a restriction that can easily drop if we just concatenate the app’s name with the module’s name.