I used selection[1] by the way, because if you use $, if your object is instanced, i've had it use another object instead, so the selection changed. So selection[1] kept the proper node, and also, if you have more than 1 object selected, it takes the 1st one, otherwise if you had $, it would error.