Run Python Function When Object is Selected

What’s the best way to run a function when an object is selected?

You might want to check this thread

Thanks, I’ll give this a try.