A measurement of direct CP violation in the decay $B^{+} rightarrow K^{+} pi^{0}$ is reported using a data sample corresponding to an integrated luminosity of 5.4 $textrm{fb}^{-1}$, collected with the LHCb experiment at a center-of-mass energy of $sqrt{s}=13$ TeV. The CP asymmetry is measured to be $0.025 pm 0.015 pm 0.006 pm 0.003$, where the uncertainties are statistical, systematic, and due to an external input, respectively. This is the most precise measurement of the CP asymmetry in the decay $B^{+} rightarrow K^{+} pi^{0}$ and exceeds the precision on the current world average. This direct CP asymmetry is a key input to studies of a long-standing anomaly in $B$ meson decays, known as the $Kpi$-puzzle. The asymmetry is consistent with the previous measurements of this quantity, confirming and significantly enhancing the observed anomalous difference between the direct CP asymmetries of the $B^{0} rightarrow K^{+} pi^{-}$ and $B^{+} rightarrow K^{+} pi^{0}$ decays.