Method to control a hybrid powertrain, comprising a combustion engine; a gearbox with an input shaft and an output shaft, which combustion engine is connected to the input shaft; a first planetary gear, which is connected to the input shaft; a second planetary gear, connected to the first planetary gear; a first electrical machine, connected to the first planetary gear; a second electrical machine, connected to the second planetary gear; at least one gear pair (G1, 60, 72) connected with the first planetary gear and the output shaft; and at least one gear pair (G2, 66, 78) connected with the second planetary gear and the output shaft, which gear pairs (G1, 60, 72, G2, 66, 78) are connected to the output shaft via a countershaft, comprising the steps: a) engaging gears in the gearbox, corresponding to the at least one gear pair (G1, 60, 72), which is connected with the first planetary gear, and the at least one gear pair (G2, 66, 78), which is connected with the second planetary gear and the output shaft; b) connecting two rotatable components (28, 32, 51) in the second planetary gear with a coupling device, characterised by the steps: f) locking a coupling mechanism, which is arranged between the first planetary gear and the output shaft, by controlling the combustion engine, in such a way that a synchronous rotational speed is achieved between the first planetary gear and the output shaft; g) activating the first electrical machine, so that the first electrical machine generates a propulsion torque on the output shaft via the coupling mechanism 96; h) disconnecting the at least one gear pair (G2, 66, 78), which is connected with the second planetary gear and the output shaft, from the countershaft which gear pair was connected in step a), by controlling the second electrical machine and the combustion engine, connected with the first planetary gear, in such a way that a zero torque state is achieved between the at least one gear pair (G2, 66, 78), which is connected on the countershaft and which is connected with the second planetary gear and the output shaft, and the countershaft; i) connecting the at least one gear pair (G2, 66, 78), which is connected with the second planetary gear and the output shaft which gear pair was not connected in step a), to the countershaft, by controlling the combustion engine in such a way that a synchronous rotation speed is achieved between the at least one gear pair (G2, 66, 78), which is connected with the second planetary gear and the output shaft, and which gear pair was not connected in step a), and the countershaft; and j) controlling the second electrical machine and the combustion engine, connected with the first planetary gear, in order to generate a propulsion torque on the output shaft. a) engaging gears in the gearbox, corresponding to the at least one gear pair (G1, 60, 72), which is connected with the first planetary gear, and the at least one gear pair (G2, 66, 78), which is connected with the second planetary gear and the output shaft; b) connecting two rotatable components (28, 32, 51) in the second planetary gear with a coupling device, f) locking a coupling mechanism, which is arranged between the first planetary gear and the output shaft, by controlling the combustion engine, in such a way that a synchronous rotational speed is achieved between the first planetary gear and the output shaft; g) activating the first electrical machine, so that the first electrical machine generates a propulsion torque on the output shaft via the coupling mechanism 96; h) disconnecting the at least one gear pair (G2, 66, 78), which is connected with the second planetary gear and the output shaft, from the countershaft which gear pair was connected in step a), by controlling the second electrical machine and the combustion engine, connected with the first planetary gear, in such a way that a zero torque state is achieved between the at least one gear pair (G2, 66, 78), which is connected on the countershaft and which is connected with the second planetary gear and the output shaft, and the countershaft; i) connecting the at least one gear pair (G2, 66, 78), which is connected with the second planetary gear and the output shaft which gear pair was not connected in step a), to the countershaft, by controlling the combustion engine in such a way that a synchronous rotation speed is achieved between the at least one gear pair (G2, 66, 78), which is connected with the second planetary gear and the output shaft, and which gear pair was not connected in step a), and the countershaft; and j) controlling the second electrical machine and the combustion engine, connected with the first planetary gear, in order to generate a propulsion torque on the output shaft.