Can I use AddComponent to add (this.script) to an object?

So, I’m not sure if my syntax is incorrect or if I am trying to do something that can’t be done.
I have a lot of scripts talking to each other, so in order to try to keep organized I’ve decided to let scripts run everything.
To preserve communication, I’m instantiating scripts instead of GameObjects, and then having the script create it’s own game object and add itself to that object.
I know that the usual is to instantiate a gameobject with scripts on it, but it would be easier for all my cross-referencing and troubleshooting if I could have scripts be instantiated, and have the gameObject created within that script.

So, here’s the code where I’m stuck:

public void selfInstantiate(GameObject obj, Vector3 pos, string ID ){
		
		GameObject flockFocusPoint = (GameObject)Instantiate(obj, pos, Quaternion.identity);
		flockFocusPoint.name = ID;
		obj.AddComponent(typeof(FlockAttractor));//this is where i'm not doing it right

		
		flockID = ID;
		FlockManager.flockIDs.Add(this);
		directionalForce();
	}

I am attempting to do something like:

obj.AddComponent < myScriptType > (this);

As in, I want this game object in the scene to have a direct reference to this individual script.
I know that’s incorrect syntax, but you get the idea. I also know that this is a bit backwards from how it’s normally done (or how I’ve seen it done so far) but this would help me immensely in my organization if it were possible.

Thanks in advance

Looks like the problem is that AddComponent attaches a new script, whereas you want to attach “this”. What about changing your code around a tiny bit, using a static class method:

public static void selfInstantiate(GameObject obj, Vector3 pos, string ID ){

       GameObject flockFocusPoint = (GameObject)Instantiate(obj, pos, Quaternion.identity);
       flockFocusPoint.name = ID;
       var thisScript = obj.AddComponent(typeof(FlockAttractor));

       thisScript.flockID = ID;
       FlockManager.flockIDs.Add(thisScript);
       thisScript.directionalForce();
    }

This way you’re only creating the script once. Does that work for your desired model?

-Kevin