Function override hook gets triggered even if the app is not installed

I have an override for an erpnext function in a custom app. This custom app is not installed for a site still the overridden function is called