I keep getting errors as I don't know how to deactivate a script that doesn't have a game object, presumably my script that "spawns objects"?

I know how to deactivate a script that has the game object but I keep getting errors as I don't know how to deactivate a script that doesn't have a game object, presumably my script that "spawns objects". I put below a player script and a "spawner" script. Please advice? thank you so much

This is the player script

 private void OnTriggerEnter2D(Collider2D collision)
{
if(collision.tag == "Package")
{
Debug.Log("Got the Package");
hasPackage = true;
collision.gameObject.GetComponent<FallingPackage>().enabled = false;
}

if(collision.tag == "Customer" && hasPackage)
{
Debug.Log("Delivered");
hasPackage = false;
}
}


This is the spawner script that spawns a game object from another script

 void Update()
{
if (Time.time > nextSpawnTime)
{
float secondsBtwnSpawn = Mathf.Lerp(secondsBtwnSpawns.y, secondsBtwnSpawns.x, Difficulty.GetDifficultyPercent());
nextSpawnTime = Time.time + secondsBtwnSpawn;

float spawnAngle = Random.Range(-spawnAngleMax, spawnAngleMax);
float spawnSize = Random.Range(spawnAngleMin.x, spawnAngleMin.y);
Vector2 spawnPos = new Vector2(Random.Range(-screenSizeUnit.x, screenSizeUnit.x), screenSizeUnit.y);
GameObject newBlock = (GameObject)Instantiate(spawnPackage, spawnPos, Quaternion.Euler(Vector3.forward * spawnAngle));
newBlock.transform.localScale = Vector2.one * spawnSize;
}
}

• What do you mean by a script that doesn't have a game object? The two snippets you've shown us both look like MonoBehavíour methods, and Unity instructs you to only ever attach MonoBehavíour scripts to GameObjects — it will throw an error if you try to construct one "free floating". Please edit your question to show us a Minimal Complete Verifiable Example of the problem — the smallest complete set of scripts (not just snippets of one method, but the whole class) and setup instructions that we can use to reproduce this problem in a new, empty project. Dec 28 '21 at 16:56

If you create an empty object in the editor, by right-clicking in the hierarchy and clicking Create Empty