Hi there are a many topics on this, search for parmTemplateGroup/parmTemplate.
Here brief overview:
Each hda can holds multiple
parmTemplateGroups [
www.sidefx.com], but a single one can be represented as an actual parameter interface. A template group can contain different types of
parmTemplates [
www.sidefx.com], such as
floatParmTemplate [
www.sidefx.com], int, string and so on. They all have their own unique methods, but also sharing common methods like name, label, type. A
FolderParmTemplate [
www.sidefx.com] acts similar to a parmTemplateGroup, which again can contain a variety of parm templates. So it is a tree structure like it is represented in the type properties parameter interface - a nested tuple in python.
To operate on this you need a reference of a parmTemplateGroup, for example:
node = hou.node('/obj/geo1/my_hda')
ptg = node.type().definition().parmTemplateGroup()
type().definition() refers to the node type parmTemplateGroup. You can also use,
ptg_spare = node.parmTemplateGroup()
to get a reference of the spare parmTemplateGroup. Which has a session/hip file life time as an instance of a node type, they are not stored in the hda/otl it self. So when ever you like to operate on the hda you have to refer to the type definition of the hda.
Here an example to change the label of an existing parameter:
# get a reference to parmTemplate
new_pt = ptg.find('my_parm_name')
# set label
new_pt.setLabel('new_label')
# update the parm group by replacing the new parm template with the existing
ptg.replace('my_parm_name', new_pt)
# apply and store changes to the parm group
node.type().definition().setParmTemplateGroup(ptg)
Also note that each parmTemplate must have a unique name. If you try to store a template with the same name houdini will act by adding indices or even avoid the operation.
For handle you task you need two node/parm group references, the source and target:
node_source = hou.node('/obj/geo1/source_hda')
node_target = hou.node('/obj/geo1/target_hda')
ptg_source = node_source.type().definition().parmTemplateGroup()
ptg_target = node_target.type().definition().parmTemplateGroup()
# get parm template reference from source
pt = ptg_source.find('my_parm')
# append to target ptg
ptg_target.apped(pt)
# apply and store changes to the target parm group
node_target.type().definition().setParmTemplateGroup(ptg_target)
There are variety of methods for example to add a template before or after to a parm template.
I would also recommend working with dummies for the time being, as this can lead to irreversible results.