Sub Doctype Implementation

Is there way where I can implement a sub doctype? Its like this Doctype A will create Doctype B and Doctype B will create Doctype C.

so there are 2 potentials questions here - sub doctypes and creating doctype on other doctype creation

afaiu frappe has concept of child doctypes which are sort of tables which you can attach to your (parent) doctype(s) (ref: Child / Table DocType)

for the “creating doctype on doctype creation” - you can use hooks (specifically the doc_events hook [ref: Hooks]). Basically Doctype is also a Doctype so you can create a doctype using frappe.get_doc utility (ref: Document API) easily (I know this is a bit doozy :slight_smile: )
also to know about various doc events → Controllers

edit: you can also achieve the same from the UI itself using server scripts (the logic will remain the same) - ref: Server Script

PS: beware that if you write something like after_insert of a doctype to create another doctype …it will also trigger that after_insert hook for the “another” doctype and so on and if you don’t provide some sort of conditional check, the db will be flooded with doctypes :laughing: in this infinite loop.