modbus slave ID setting
It looks like the problem may be initialisation order. In C/C++, global variables/objects are usually initialised in the order they are declared, and before any global functions run.

In your case, this means ID_Check() gets called before array is populated, and before setup() runs.

It looks like you need to make sure everything else is setup before your attempting to initialise the Modbus object. I'm not familiar with the library, but perhaps there's a way to set the device ID after it's been constructed (i.e. not in the constructor)?

If not, you could declare slave as a global pointer, and then instantiate it using new in setup().

As a side note, I'm guessing your Modbus_Setup() function didn't work because the slave object in there is completely separate from the slave object that's declared globally and used in loop().