Below gets the focus back on the first tab of the pyTag (after other objects have been selected), but it only works with/after a button click..
Perhaps this might be of use.
def message(id, data):
if id == c4d.MSG_DESCRIPTION_COMMAND:
id2 = data['id'][0].id
if id2 == c4d.ID_USERDATA:
userDataId = data['id'][1].id
if userDataId == 1: # << just a button on the pyTag with ID 1
### do some function...
# GET FOCUS BACK on the pyTags's 1st Tab:
op.GetObject().SetBit(c4d.BIT_ACTIVE)
op.SetBit(c4d.BIT_ACTIVE)
c4d.gui.ActiveObjectManager_SetObject(c4d.ACTIVEOBJECTMODE_TAG, op.GetObject(), c4d.ACTIVEOBJECTMANAGER_SETOBJECTS_OPEN, c4d.DescID(c4d.DescLevel(1)))
op.GetObject().DelBit(c4d.BIT_ACTIVE)
c4d.EventAdd()