Could be the PDC module. It’s part number 1 in this diagram:

http://bmwfans.info/parts-catalog/E4...e_control_pdc/

Happened on both my e46s. I think on mine 2 were clicking. It’s located in the boot, behind the grey carpet panel on the right hand side. If you’re replacing it then get a new genuine one though. I tried 2 second hand ones on eBay and none of them worked. It would obviously be better if you could try out a working one but not sure if that’s an option.