Abstract The scattering of electrons by heat-flux-driven whistler waves is explored with a particle-in-cell simulation relevant to the transport of energetic electrons in flares. This simulation is initiated with a large heat flux produced by using a kappa distribution of electrons with positive velocity and a cold return current beam. This system represents energetic electrons escaping from a reconnection-driven energy-release site. This heat-flux system drives large-amplitude oblique whistler waves propagating both along and against the heat flux, as well as electron acoustic waves. While the waves are dominantly driven by the low-energy electrons, including the cold return current beam, the energetic electrons resonate with and are scattered by the whistlers on timescales of the order of a hundred electron cyclotron times. Peak whistler amplitudes of and angles of ∼60° with respect to the background magnetic field are observed. Electron perpendicular energy is increased, while the field-aligned electron heat flux is suppressed. The resulting scattering mean-free-paths of energetic electrons are small compared with the typical scale size of energy-release sites in flares, which might lead to the effective confinement of energetic electrons required for the production of very energetic particles.