Should I use modules for AI?

So basically what I’m trying to do is make hostile NPCs spawn at a certain rate, they can get stacked up to a certain limit.

My question is, should I use a module script to hande their AI? For example, make an entire module with all of their behaviour and make the NPC just have a script that calls for those functions instead of copying and pasting the same code on all of them.