Obtain maya reference rig name

I’ve been working on a snapping tool but would like for it to work with reference rig. Is there some way of obtaining or input the ref name without having to enter the code?
The way it works is by using the bones naming convention but once a ref rig is created it does not work anymore since the names are different.

bone name - L_Clavicle
ref bone name - Game_Res_Rig:L_Clavicle

If your tool gets the object from the current selection :

name_with_namespace =  "Game_Res_Rig:L_Clavicle" 
name = name_with_namespace.split(":")[-1]

The same split technique can be used with | character to get short name from long name.

There is more than one way to find an object independent of namespace.
Can you show the code you are using to ‘find’ the desired joints?

right now I just look for the name of the bones with the stablished naming convention so is not by selecting but looking a joint with the name and modifying its attributes

        fkwrist = self.refName + "L_Wrist_FK_CTRL"
        fkshldr = self.refName + "L_Shoulder_FK_CTRL"
        fkelbow = self.refName + "L_Elbow_FK_CTRL"
        ikwristJnt = self.refName + "L_Wrist_IK_J"
        ikshldrJnt = self.refName + "L_Shoulder_IK_J"
        ikelbowJnt = self.refName + "L_Elbow_IK_J"

       self.FKMatching(fkshldr, fkelbow, fkwrist, ikshldrJnt, ikelbowJnt, ikwristJnt)

I think maybe the name split is a good solution. Will try it.

Thank you!

the ls() command has recursive flag that ignores name spaces:

import maya.cmds as mc
fkwrist = mc.ls("L_Wrist_FK_CTRL", recursive=True)[0]

this way you don’t spend time splitting strings
also handles nested references, which may have multiple : seperators.