Perhaps you’re making it more complicated that necessary.
- you could easily have Hazel send the files to the correct DT group
- or have DT do the tagging (is that needed for anything but to determine which group the file goes to?) and grouping itself.
I’ve written a sample script for the second approach sike time ago