add c# code from a file outside of assets folder

so i want to add a c# file from Application.persistentDataPath so modding is easier on my game, if there isn’t any way for that i guess ill have to make a customizable enemy AI thing.

You can do this with runtime compilation but please note here:

Don’t blindly execute code from third party sources at runtime. This is a massive security risk.
So if you have a game and want to offer modding: Make sure to add a ton of security measures.

That being said, check out the following Link which contains a small code example:

Link to stackoverflow

You cant add code from outside of the assets folder