Create rules for gradle dependencies between modules

Hello, I have a question regarding gradle dependecies.
I need a way or a tool that will allow me to restrict the dependencies between my project modules.
For example I want to create a rule like that: Module A can’t have any dependency to Module B,C or any other modules or variants I need.
I have tried using Archunit, but I can’t use it on a module level and when trying to write a Kotlin plugin I didn’t find any solution to do what I want.
Is this even possible? Can we enforce dependency rules between modules in gradle and if we can how should I aproach this?

This plugin should allow you to do what you want: GitHub - jraska/modules-graph-assert: Gradle plugin to keep your modules graph healthy and lean.