Method to control a hybrid powertrain , comprising a combustion engine ; a gearbox with an input shaft and an output shaft ; a first planetary gear , which comprises rotatable components and is connected to the input shaft and a first main shaft ; a second planetary gear , which comprises rotatable components and is connected to the first planetary gear and a second main shaft ; a first electrical machine , which is connected to the first planetary gear ; a second electrical machine , which is connected to the second planetary gear , wherein the electrical machines may operate each other; 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 , wherein the combustion engine is connected with a first planetary wheel carrier , arranged in the first planetary gear via the input shaft , and wherein the second main shaft is connected with a planetary wheel carrier , arranged in the second planetary gear , the method comprising the steps, while the combustion engine is in operation: a) to ensure that at least one gear is engaged, corresponding to the at least one gear pair (G1, 60, 72), connected with the first planetary gear , and/or corresponding to the at least one gear pair (G2, 66, 78) connected with the second planetary gear , b) to activate the first electrical machine and the second electrical machine , in such a way that the total electric power output from the first and second electrical machines is substantially zero, and in such a way that a torque is generated in the output shaft , characterised by c) ensuring that the rotatable components of the first planetary gear are disconnected from each other, and that the rotatable components of the second planetary gear are disconnected from each other, and disconnecting, with a first coupling device , a first sun wheel arranged in the first planetary gear , and a first planetary wheel carrier , from each other; and disconnecting, with a second coupling device , a second sun wheel arranged in the second planetary gear , and a second planetary wheel carrier , from each other. a) to ensure that at least one gear is engaged, corresponding to the at least one gear pair (G1, 60, 72), connected with the first planetary gear , and/or corresponding to the at least one gear pair (G2, 66, 78) connected with the second planetary gear , b) to activate the first electrical machine and the second electrical machine , in such a way that the total electric power output from the first and second electrical machines is substantially zero, and in such a way that a torque is generated in the output shaft , characterised by c) ensuring that the rotatable components of the first planetary gear are disconnected from each other, and that the rotatable components of the second planetary gear are disconnected from each other, and disconnecting, with a first coupling device , a first sun wheel arranged in the first planetary gear , and a first planetary wheel carrier , from each other; and disconnecting, with a second coupling device , a second sun wheel arranged in the second planetary gear , and a second planetary wheel carrier , from each other. <EOS>