Using Interrupts With If Statements

if an interrupt occurs during an if statement, after the interrupt does the rest of the if statement run or does it go back to the main code? I have a linear actuator controllong a door for my cats to go in and out. There is a switch on the door to determine if it's opened or closed. I have a touch sensor inside the house and one outside the house that the cats step on to initiate the code. I also have 2 limit switches to control the linear actuator's travel limit. I'd like the code to run as follows.
if a cat steps on the inside sensor the light will come on, the linear actuator will start moving and open the door until it hits the upper limit switch and stops. The door should stay open for 5 seconds. Then the linear actuator will start reversing to close the door until it hits the lower limit switch and stops. Light turns off.
The same code should run if a cat steps on the outside sensor , or if there is a cat standing on the inside sensor and a cat standing on the outside sensor at the same time.

const int upperLimitswitch = 2;  // upper limit switch
const int lowerLimitswitch = 3;  // lower limit switch
const int inSensor = 4;
const int outSensor = 5;
const int doorSensor = 6;
const int motorRelay1 = 7;  // relays wired as a DPDT switch to control linear actuator
const int motorRelay2 = 8;
const int lightRelay = 9;
int inSensorVal;
int outSensorVal;
int doorSensorVal;

void setup() {
  pinMode(upperLimitswitch, INPUT);  // wired normally closed
  pinMode(lowerLimitswitch, INPUT);  // wired normally closed
  pinMode(inSensor, INPUT);  // wired normally open
  pinMode(outSensor, INPUT);  // wired normally open
  pinMode(doorSensor, INPUT);  // wired normally open
  pinMode(motorRelay1, OUTPUT);
  pinMode(motorRelay2, OUTPUT);
  pinMode(lightRelay, OUTPUT);
  attachInterrupt(digitalPinToInterrupt(limit1), uplimit, LOW);
  attachInterrupt(digitalPinToInterrupt(limit2), lowlimit, LOW);
}
void uplimit() {                            //stops linear actuator
  digitalWrite(motorRelay1, LOW);
  digitalWrite(motorRelay2, LOW);
}
void lowlimit() {                          //stops linear actuator
   digitalWrite(motorRelay1, LOW);
  digitalWrite(motorRelay2, LOW);
}

  void loop() {
inSensorVal = digitalRead(inSensor);
outSensorVal = digitalRead(outSensor);
doorSensorVal = digitalRead(doorSensor);
// Condition 1
    if (doorSensorVal == HIGH && inSensorVal== HIGH && outSensorVal == LOW) {
      digitalWrite(lightRelay, HIGH);  //Light comes on
      digitalWrite(motorRelay1, HIGH);  // linear actuator moves out to open door
      digitalWrite(motorRelay2, LOW);  // linear actuator moves out to open door to trigger 
                                                                 // upper limit switch
    }
Condition 2:
    if (doorSensorVal== HIGH && inSensorVal == LOW && outSensorVal == HIGH) {
      digitalWrite(lightRelay, HIGH);  //Light comes on
      digitalWrite(motorRelay1, HIGH);  // linear actuator moves out to open door
      digitalWrite(motorRelay2, LOW);  // linear actuator moves out to open door to trigger 
                                                                 // upper limit switch
    }
 // Condition 3:
    if (doorSensorVal == HIGH && inSensorVal == HIGH && outSensorVal == HIGH) {
      digitalWrite(lightRelay, HIGH);  //Light comes on
      digitalWrite(motorRelay1, HIGH);  // linear actuator moves out to open door
      digitalWrite(motorRelay2, LOW);  // linear actuator moves out to open door to trigger 
                                                                  //upper limit switch
    }
  }

Upon interrupt exit, processing will continue as if the interrupt had never happened.

It would be much better if you ditched those interrupts and coded up your project as a state machine (search "Finite State Machine")

Also, your input comments " normally closed" but does that mean there are external pull-up resistors? If not, you need to make those input of type INPUT_PULLUP so those inputs are not floating. They need to be either tied HIGH or LOW.

As for the state machine, you start out in the IDLE state. If you detect input either inside or outside, you turn on the light and transition to DOOR_OPENING state. During this state, you monitor you limits switches, and when they trip, you transition to DOOR_OPEN state and note the time with millis(). While you monitor DOOR_OPEN, you determine elapsed time [millis() - startTime] and if it has been 5 seconds, you transition to DOOR_CLOSING state. During this state, you again monitor your limit switches [careful to monitor the correct switch since at the start, the other limit switch may still be closed] and the turn off the light and go back to the IDLE state.

There are many examples of this type of code if you search. It is a powerful way to implement projects like this but does take a different understanding of the code.

I second this

Here is a small introduction to the topic: Yet another Finite State Machine introduction

There is no need and no advantage to using interrupts in this code. Just add 2 more if-statements.

When a interrupt occur the Program counter is stored and the Program counter is re directed to the interrupt line.

When the ISR is done the Program counters stored value where it was before the interrupt is loaded + 1 , so the next line in the IF statement will get executed.

Strictly speaking, when the interrupt returns, the code that was interrupted will continue at the next machine code instruction. It may have been in the middle of working on a line of code from the sketch. In this case it won't execute the next line of the if statement, it will continue executing the line it was 1/2 way through executing.

Yes, I'm using an external 10K resister for each switch.

I'm going to try that. Thank you...

Good. Even better is get rid of the external component and use the internal pull-up resistors that are build in. Less parts, less soldering, and one less thing to worry about.

void setup() {
  pinMode(upperLimitswitch, INPUT_PULLUP);  // wired normally closed
  pinMode(lowerLimitswitch, INPUT_PULLUP);  // wired normally closed
  pinMode(inSensor, INPUT_PULLUP);  // wired normally open
  pinMode(outSensor, INPUT_PULLUP);  // wired normally open
  pinMode(doorSensor, INPUT_PULLUP);  // wired normally open
...

What happens to the cat when it decides to just sit in the middle for more than 5 seconds? You get two halves of a cat?

Ok. What size resisters are used for the pullup?

I have 2 cats but will be babysitting 5 more this summer. If a cat is on both sensors the code will run. If they are still sitting there after the code runs it'll run again I suppose.

That's way over my head. I haven't been coding long.

If you use INPUT_PULLUP you don't need any resistors on your input.

For that to work, the switches must be wired a certain way. We don't know how the switches are wired, the OP did not show a wiring diagram.

OK. The switches can be re-wired to ground if necessary.

according the the datasheet, the internal pull-up resistors are around 50k.