Object that tracks nearest object

Hello, How to make an object that tracks nearest object from the objects that have the same “property”?

This might help: https://blenderartists.org/forum/showthread.php?233323-Python-Track-To-and-Steering-Track-to-selection&highlight=

Here you go: track_to_closest.blend (940 KB)

Look at this line:

ai = [obj for obj in scene.objects if 'track_to' in obj]

‘track_to’ is the property it looks for.