i2c Mage & Uno with 3x4 keypad, keypad not working

Hi,
I have a Mega and an Uno connected to each other using i2c.
There is also a 3x4 keypad using the keypad.h library attached to the uno.
I want to send the input from the keypad from the uno to the mega this fails to do this.
I believe that there is an issue with the code as the hardware setup does work if i just assign a variable to the code(Slave).
The first sketch is from the Mega2560 and is the master.
The second sketch is from the Uno and is the slave.
The third sketch is basically just a theory to test and see if the basic code will work.
That code does work and returns a single character then stops.
Which is what I am looking for, but this will not work in the slave sketch.
Got this 3x4 keypad a while ago, just tinkering…
Thank You for the help in advance.

//Master Code Mega2560
#include <Wire.h>

void setup() {
  Wire.begin();
  Serial.begin(9600);

wireSend();
}

void loop() {
  
}

void wireSend() {

    Serial.println("Request from Master sent"); //A comment that it has started
    Wire.requestFrom(50, 1); //Address 50, requesting 1 character
    Serial.println("WAITING");//A comment that the Mega is waiting for the Uno
    while(Wire.available()){//Waiting for an input from the Uno
    char c = Wire.read();
    Serial.print(c);//Print the character
  }
}
//Slave Uno
#include <Wire.h>
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {8 ,9 ,10, 11}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 6, 7}; //connect to the column pinouts of the keypad

Keypad customKeypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup()
{
  Wire.begin(50);
  Wire.onRequest(getNumber);
}

void loop()
{
  delay(100);
}
void getNumber() {  
//char key = '3'; //If uncomment this line and comment out the 3 lines below, it will work
  digitalWrite(LED_BUILTIN, HIGH); //An external indicator on the Uno to show that it is up to this point in the code
  char key = customKeypad.getKey();// This is where it gets hung up... Tried using getKey and same result
  if (key != NO_KEY) {// Maybe it gets hung up here as well...
    
  digitalWrite(LED_BUILTIN, LOW); //An external indicator on the Uno to show that it is up to this point in the code
  Wire.write(key);//Not 100% if should use (char(key)) or just (key) both seem to work in this line if uncommenting the first line
                      //and commenting the following 3 lines after the first line
  }
}// If uncommenting the 3 lines above, have to uncomment this as well
//Keypad Modified
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {8 ,9 ,10, 11}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 6, 7}; //connect to the column pinouts of the keypad
int encoderPos;
Keypad customKeypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  Serial.begin(9600);
  test();
}
  
void loop(){
  }
  
void test(){
  char key = customKeypad.waitForKey();//waitForKey works, getKey does not work
  if (key != NO_KEY) {
    Serial.println(char(key));
  }
}
    Serial.println("WAITING");//A comment that the Mega is waiting for the Uno

The comment is wrong. Wire.requestFrom() doesn't return before the complete read request is handled. As the Mega is the master it dictates the time when this happens as it provides the clock signal. The slave might use clock stretching to make the master wait but this should be kept as short as ever possible as it blocks the master and the bus.

The getKey() method just checks if a key got pressed since the last call. If this isn't the case it will return NO_KEY. As you're doing this check only once it won't give you any result.

The getKey() method is not constructed in a way that makes it a candidate to be called from the requestEvent routine (which you call "getNumber"). It needs to much time to do it's work. Call that in the loop routine and store a possible key stroke in a global variable (don't forget to declare that 'volatile'). In the requestEvent you can then simply return the content of that variable, which will be fast enough. requestEvent is called in interrupt context, so you're not free to use any code there. Everything that depends on interrupts to be active (many methods of the Serial object for example) must not be used as all interrupts are disabled and the I2C bus is blocked (by using clock stretching) during the whole time this routine executes.