Top-level items don't have a parent, so you could do:
def item2Clicked(self, item, column):
if item.parent() is not None:
self.textEdit.insertPlainText("hello")
More generally, you can set a type for each item in the constructor:
item = QtWidgets.QTreeWidgetItem([name], 1)
self.treeWidget.addTopLevelItem(item)
for cmd in description:
item2 = QtWidgets.QTreeWidgetItem([cmd], 2)
and then do:
def item2Clicked(self, item, column):
if item.type() == 2:
self.textEdit.insertPlainText("hello")