Include custom print format from other doctype

Hello
I ve created two doctypes, and one doctype is connected to the other.
I ve already create for the “conntectd” doctype a custom print format.

now I like to create a custom print format for the “main” doctype and I like to include all conntected doctyps with the custom print format.

I know I can access the conntected doctype with frappe.get_all() and access every field, but I dont like to write the same custom print format inside the “main” print format. I just want to include the already existing print format

I expect something like this

{% for item in frappe.get_all('doctypeName',filters={"name": "filtercondition"}) %}
    
    {% include "custom printformat" for item  %}
{%endfor %}

thanks