We use a fly trap on the farm when flies get too close to the house (eg dead animal somewhere in the bush - buried it causing the cloud of flies to wander all over the place).
Cut some fly sized holes in the top of a plastic bottle, make a collar to shade the holes and tie a string, or put a cup hook on the neck / lid to hang on a fence or tree.
Put some meat/fat scraps into a plastic bottle with a couple of drops of detergent and fill with water to about a quarter depth. Meat has to go off before the trap starts to work, so I usually put the meat in the sun for a while, or use a bit of the dead beastie.
Hang in the sun. The flies are attracted to the smell (it gets foul), they go through the holes, but then don’t find their way back out because the holes are shaded, they eventually land in the water and drown. Empty into the compost, recharge and go again. Not suitable for indoor use.