The energy $E$ of the partical within the well must be invariant with respect to coordinate system chosen by the observer. Therefore, its value must be derived in a fashion independent of the position of the well. The Bohr-Sommerfeld rule for the quantizaation of momentum allows for this derivation of the value of $k$ in a frame-independent fashion.1
It can be shown that for a constant potential $V(x)$ in a region with turning points $x_{a}$ and $x_{b}$, the ground state energy $E_{1}$ can be calculated from
\[ \int_{x_{a}}^{x_{b}} k_{1} dx = n \pi \notag \]
Substituting Eq.\eqref{Eq:k} into Eq.\eqref{Eq:n-length} and solving for $E$ results in
\[ E_{n} = \frac{n^{2} \pi^{2} \hbar^{2}}{2 m L^{2}} \notag \]
The quantization of energy is the same as that noted in the traditional approach. However, obtaining the result from the Wilson-Sommerfeld rule relies on the length $L$ of the well which is invariant.
HA Mavromatis, {\em Exercises in Quanum Mechanics. Wilson-Sommerfeld Quantization Condition}. vol.2. 1987. Chapter 1, pg.1. [↩]
F.A. Serrano, “Qiang-Dong proper quantization rule and its applications to exactly solvable quantum systems” J. Math. Phys. 51, 082103 (2010); https://doi.org/10.1063/1.3466802. [↩]