Install doctype if another doctype exist

Hi,
I am building an app.
My Doctype some of fields are required another app’s doctype. I want to if doctype is not exits remove link from doctype when installing app.

Is it possible ?

Thanks…