Better. Replace elif with if.
Code:
def toggleLink():
global link
if link:
#If link exits, stop grabbing
link.remove()
link = None
if vizmat.Distance(hand.getPosition(), ball.getPosition()) < .5:
link = viz.grab( hand, ball )
vizact.onpick(ball,toggleLink)