Test Object parent iframe relationship identification via script

Hi,

In our case we need to know the Test Object has a parent relationship or not , without opening the Object Repository properties .

We need to achieve this via script without opening the settings , so kindly suggest me if there is any way to proceed further .

Please suggest

if(findTestObject("My/object").getParentObject() == null) {
	println "No parent object"
} else {
	println "Has parent object"
}

Thank you so much Marek_Melocik for your response

It is working as expected.