Grabbing a bit from a configuration register

I’ve instantiated an array of 32-bit registers and have stored a value in bit 0 of register 0. I wish to use that bit to control my counter but have not succeeded.

My code includes

period_counter = counter(reset=reset, clock=clock, clear=False, enable=register_array[CONTROL_REGISTER_1][COUNT_ENABLE], count=count)

but this fails with

TypeError: '_Block' object does not support indexing

so I moved the bit out to an always_comb block so the code looks like this

period_counter = counter(reset=reset, clock=clock, clear=False, enable=count_enable, count=count)

but I get the same result. Can someone tell me where I have gone astray?

Many thanks.

Can you show us how you define register_array?

Your question has revealed the problem. I think I must have needed a break from staring at the code. There is nothing to learn from this post so it should be deleted.