Script for adding selected object to current renderlayer

hi, i have a heavy scene. i want to add some objects to one renderlayer. now if i right click over renderlayer to add those objects its taking long time to get option(sometimes not at all). any one can help me with a script so i can selct object nd run the script so it will add in the current render layer.
thanks

Hi, there.
Well, I do not use MEL but use Python.
If you don’t mind, You can use the Python code below:

import maya.cmds as mc

sCurrentRL = mc.editRenderLayerGlobals(query = True, currentRenderLayer = True)
sSelect_L = mc.ls(sl = 1, l = 1)

mc.editRenderLayerMembers(sCurrentRL, sSelect_L)