Firstly. As you have to type the number of modules into the array you may as well total them up and declare the array as normal.
This is what I'm doing for now, but it could be helpful if I'm able to change the size of the array dynamically.
Secondly. Move the calculation of the array size to the loop() function and declare the array there. Pass the array, or a pointer to it and its size, to any functions that use it.
How do you do that?