It would keep them well out of the yard, wouldn’t it?
Double ought buckshot would be a more permanent solution.
It depends on how big, and how open, your yard is. Down around Ms. Switch's way, it would just blow away 90+% of the time.
Plus you need something to deliver it. I don't know if they make tear gas rounds for the "pseudo" M-209 and M-79 type launchers, but I suspect such are available.