Identifying map tile with mouse click

The last code snippet I posted was missing a line. It should be:

            while nodepath != render:
                if nodepath.hasTag('tile node'):
                    tile = nodepath
                    break 
                nodepath = nodepath.getParent()