Does Delay Function Delay Everything?

Newbie question. I’m working on a simple Light Automation when there is motion.
If motion detected then turn on light… then delay for 5min then turn off light.
My question is this, Does the Delay make the entire code pause? I’m worried that
while the code is paused during that 5 min, there could be motion elsewhere that never goes thru the automation. If the delay does cause the entire code to pause, is there a way around this?

Thanks in advance.

The delay is just related to the current automation.

Delay is fine, it’s WAIT that can cause performance issues because it does actually create a loop that, for all intents and purposes, pauses the code but also take resources to wait.

I haven’t looked at the code, but if the proper wait function is used the impact on performance should be negligible. In order to do this wait functions simply release the Global Interpreter Lock, allowing execution to resume.