The rising application of conventional synthetic insecticides develops resistant populations of houseflies; therefore, using new chemical agents with different modes of action is essential to overcome this problem. The mechanical grinding technique was used as a green method, to synthesize the tested compounds because it is a more facile work‐up and high‐yield economy, simplicity and solvent‐free than conventional thermal technique. Various methods were employed to synthesize new heterocycles containing anthracene (a photosensitizing agent) from chalcone 3, a building block material such as the preparation of the pyrazole derivatives 4–7, isoxazole derivative 8, pyrimidines 9–11, and oxirane derivative 12. The novel synthesized compounds were analyzed by FT‐IR, 1H‐NMR, 13C‐NMR spectra, and elemental analysis. Herein, the toxicity of the anthracene derivatives was assessed against Musca domestica larvae and adults in different conditions to demonstrate the effect of various inserted moieties on the efficiency of tested compounds. Furthermore, the influence of sunlight on the toxicity of anthracene was studied in dark and sunlight tests against adult houseflies. Moreover, these compounds diminished the total protein and lipids contents while significantly influencing the antioxidant enzymes activities of M. domestica adults. Structure‐activity relationships demonstrated the role of each moiety on the toxicity of compounds.