Short answer: There is no short answer for this one.
Looking at the rack side of things first.
First up - This answer is assuming a SNAP-PAC system. The answer is different if its a G1, G4 or Mistic system.
No, you don't 'have to' turn power off when swapping a 4-channel digital input or output module, ie. the same module swapped for the same module type in the exact same position.
(We recommend it, but you don't have to).
Reason is that the digital points are 'hard wired' to the controller/io, so it's a pretty straightforward event for the I/O processor to handle. Digital points are just on or off, it does not know if that's what the module is doing, or if the module is missing.
That said, you can't swap an input module for an output or the other way around, because the I/O processor does keep track of what its pins are configured for, innies or outies.
(That's why you can't add a digital module and have it work. You need to tell the I/O brain what modules are where - it needs to configure its pins as inputs, outputs or data - this is done via the configuration in the strategy).
Keep in mind that if you have any points that are 'On', they are going to turn off as far as the strategy is concerned when you unplug the module.
This applies for both inputs and outputs.
So, you need to think about what's going to happen in your strategy when that digital input point(s) turns off.
What's going to happen when that digital input turns off in your strategy? What if that input is a flow switch, and when it turns off, the strategy turns off the whole system?
When you plug in the new output module, will your strategy turn that point back on? What if the point was on before you swapped modules, but the strategy is now in a timer loop, you swap the module, but the point is not going to turn on till after the timer expires, what happens in the mean time to your process, is the tank going to run dry because the pump is not running?
Yes, you need to power down the rack when swapping analog modules AND HIGH-DENSITY DIGITAL MODULES.
Analog (and all high density digital modules (input or output)) are intelligent. This means they are having a little conversation over the rack to the I/O processor at all times. (EB or R - both have an I/O processor).
You can't just jerk out a module during that conversation. So don't.
Regarding restarting the strategy.
There are two different answers. One for digital, one for analog. (ie, one for leaving the rack on, one for turning the rack off).
Digital: As mentioned in the digital module swap answer, if your strategy is keeping on top of reads and writes, you probably don't need to restart the strategy.
Analog: Since you can't change the modules with the power on, the rack is going to go offline from the controller. When you power back up the rack, it will not automatically get back online with the controller.
No matter what module swapping might be going on, you should be running some sort of I/O enabler chart;
This is the chart provided and supported by Opto.
You can use that, or write your own, but no matter what, you should be re-enabling communications to the I/O units from your strategy.
You should be keeping track of what I/O racks are going on and off line.
You should be managing the strategy to handle off line racks. In other words, there is no point turning on a pump if the rack that the pump digital output is on is offline.
Racks go offline for two main reasons, power cycle and network connectivity issues.
You need a chart / strategy to deal with reconnecting the controller to remote I/O. The good thing is that power and network issues can be dealt with the same way since they look the same to the controller.... the I/O simply stops responding.
So, to sum it up.
Yes, you 'can' hot swap the same 4-channel digital module for the same digital module in the same location.
No, you can't hot swap analog (or high density digital modules) modules.
Yes, you will either need to restart the strategy or have a chart that re-enables the I/O rack if you cycle power or re-establish network connectivity.
However, I gota ask..... How often and why the need to hot swap modules?
In 25 years of using Opto gear, I have never needed to swap modules. They just don't go bad. No really..... Other than lighting, I have never had a module just go bad. (Other than during commissioning when we find people have wired 240 VAC to a 24 VAC module).
Hope that helps.