Subroutine problems

Hi everyone.
First of all sorry for my poor English. I hope you will understand me.

I am begginer in Arduino and I have problem with calling the subroutine programs.
When i pressed the key 1 on keypad the program normal goes to soubrutine1, but when i pressed key 2 in subroutine1 the program should go to subroutine2 and stepper should rotate, but nothing happened. Why?

In project what I am doing I need many subroutines in program.

Thanks for your help.

#include <LiquidCrystal.h> 
#include <Keypad.h> 
#include <Stepper.h> 

const byte rows = 4;
const byte cols = 4;

char keys[rows][cols] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};

byte rowPins[rows] = {5,4,3,2};
byte colPins[cols] = {27,26,25,24};

Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, rows, cols);

LiquidCrystal lcd(37, 36, 43, 42, 41, 40);  

Stepper myStepper(2048, 48,50,51,49);

void setup()
{
  lcd.begin(2, 16); 
  myStepper.setSpeed(14); 
  lcd.setCursor(0,0);
  lcd.print("Stepper test"); 
  lcd.setCursor(2,1);
  lcd.print("machine"); 
  delay(5000); 
  lcd.clear(); 

}

void loop()

{ 
  char key = keypad.getKey();
  if(key=='1'){
  subroutine1();
 }
}
  
void subroutine1()

{
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("For starting"); 
  lcd.setCursor(2,1);
  lcd.print("press key 2"); 
    char key = keypad.getKey();
     if(key=='2'){
     subroutine2();      
 }
 }

void subroutine2()

{
 myStepper.step(2048);   
}

subroutine2() is called in subroutuine1(). That means that you have to press key 1, and then within microseconds, press key 2. I doubt that is what you are going for.

Keypad keypad(makeKeymap(keys), rowPins, colPins, rows, cols);

With keypad in "voidloop()" I want choose which stepper I want to test: (Key1=stepper 1, key2=stepper2, key3=stepper3..) and with this I call subroutine for each stepper: (key1=subroutine1(), key2=subroutine2(),key3= subroutine3()...) each stepper has its own settings:( delay time, steps).

In this "call subroutine" i must again choose how many revolutions stepper should done. (key1= 10revolutions, key2= 50revolutions, key3= 100revolutions, key4=500revolutions...) and stepper will start rotate.

Sorry again for my poor English.

Thanks.

It sounds like you are trying to implement a sequential menu, as in, the first press tells you which stepper, the second tells you how many revolutions, etc. In this case, you need stop thinking in terms of subroutines and start thinking in terms of a finite state machine, with states such as CHOOSING_MOTOR, CHOOSING_STEPS, etc.