  We report on new multi-frequency Very Large Array (VLA) radio observations
and Chandra X-ray observations of a radio-loud quasar with a ~300 kpc long jet,
PKS 1127-145, during a flaring event detected in $\gamma$-rays by the Fermi
Large Area Telescope in 2020 December. The high angular resolution of the new
radio images allows us to disentangle for the first time the inner kpc-scale
jet from the core contribution. The inner radio jet, up to 15 kpc from the
core, is highly polarized (33 per cent) and the magnetic field is parallel to
the jet axis. At about 18 arcsec from the core the jet slightly bends and we
observe a re-brightening of the radio emission and a 90-degree rotation of the
magnetic field, likely highlighting the presence of a shock that is compressing
the magnetic field to a plane perpendicular to the jet axis and where efficient
particle acceleration takes place. At the same position the X-ray emission
fades, suggesting a deceleration of the bulk velocity of the jet after the
bend. A change in velocity and collimation of the jet is supported by the
widening of the jet profile and the detection of a limb-brightened structure
connecting the bending region with the jet termination. The limb-brightened
structure might indicate the co-existence of both longitudinal and transverse
velocity gradients at the jet bending. There is no evidence for significant
brightening of the kpc-scale jet in the radio or X-ray band during the
$\gamma$-ray flare. The X-ray flux, $F_{\rm 2-10\,keV} =
  (6.24\pm0.57)\times10^{-12}$ ergs s$^{-1}$ cm$^{-2}$, measured by Chandra
from the quasar core is consistent with the flux measured by the X-Ray
Telescope on board the Neil Gehrels Swift Observatory after the high-energy
flare. Our results indicate that the $\gamma$-ray flaring region is located
within the VLA source core.
