The TDM tree is just a python dictionary where channels is just a python array.
self.tdm_tree = {
"author": "National Instruments",
"description": "Example file",
"groups": [{
"name": "Example",
"description": "The first group",
"time": datetime.datetime(2020, 2, 11, 15, 31, 59, 342380),
"channels": [{
"name": self.channelNames[0],
"description": "",
"values": [],
"info": "Time in seconds",
"type": "DataTypeChnFloat64"
}]
}]
}
So you can work on the structure using standard python mechanisms to extend and modify it.