Method for controlling a power train for a motor vehicle comprising two electrical machines, an internal combustion engine and a gearbox, characterized in that it comprises the following steps for determining the torque setpoints of the internal combustion engine and of the electrical machines: - for each electrical machine and for the internal combustion engine, a torque differential is determined as the absolute value of the difference between a setpoint at the preceding instant and a target torque setpoint at the end of torque distribution, upon a change of gear, then - for each electrical machine and for the internal combustion engine, a boolean variable is determined that indicates the state of the torque distribution phase and a boolean variable indicating the end of the torque distribution phase of the internal combustion engine according to a first instant, defined as the instant of start of torque distribution, of a second instant defined as the instant of torque distribution of the internal combustion engine and of the torque differentials for each electrical machine and for the internal combustion engine, - when the present instant is after the first instant, a determination is made that a raw torque setpoint is equal, for the internal combustion engine, to the target torque setpoint at the end of torque distribution at the preceding instant, and, for each electrical machine, it is a function of the torque setpoint on the wheel reflecting the will of the driver, estimations of the torque produced by the internal combustion engine and by the electrical machines, transmission ratios between the wheels, the internal combustion engine and the electrical machines, - for each electrical machine and for the internal combustion engine, an unsaturated torque setpoint is determined that is equal to the raw torque setpoint saturated by a maximum torque gradient, - for each electrical machine, a determination is made that a saturated torque setpoint is equal to the maximum value between the minimum torque that can be produced and the minimum value out of the unsaturated torque setpoint and the maximum torque that can be produced and that an intermediate torque setpoint is equal to the saturated torque setpoint, if the present instant is prior to the second instant, and, otherwise, to the target torque setpoint at the end of torque distribution. - for each electrical machine and for the internal combustion engine, a torque differential is determined as the absolute value of the difference between a setpoint at the preceding instant and a target torque setpoint at the end of torque distribution, upon a change of gear, then - for each electrical machine and for the internal combustion engine, a boolean variable is determined that indicates the state of the torque distribution phase and a boolean variable indicating the end of the torque distribution phase of the internal combustion engine according to a first instant, defined as the instant of start of torque distribution, of a second instant defined as the instant of torque distribution of the internal combustion engine and of the torque differentials for each electrical machine and for the internal combustion engine, - when the present instant is after the first instant, a determination is made that a raw torque setpoint is equal, for the internal combustion engine, to the target torque setpoint at the end of torque distribution at the preceding instant, and, for each electrical machine, it is a function of the torque setpoint on the wheel reflecting the will of the driver, estimations of the torque produced by the internal combustion engine and by the electrical machines, transmission ratios between the wheels, the internal combustion engine and the electrical machines, - for each electrical machine and for the internal combustion engine, an unsaturated torque setpoint is determined that is equal to the raw torque setpoint saturated by a maximum torque gradient, - for each electrical machine, a determination is made that a saturated torque setpoint is equal to the maximum value between the minimum torque that can be produced and the minimum value out of the unsaturated torque setpoint and the maximum torque that can be produced and that an intermediate torque setpoint is equal to the saturated torque setpoint, if the present instant is prior to the second instant, and, otherwise, to the target torque setpoint at the end of torque distribution.