Study of pressure induced physical variations in the electronic and optical properties of MgA2Te4 (A = Sc, Y)