Electric machine connected or connectable to gearbox internal shaft