After updating from Godot 3 to 4, the error "Identifier "global_position" not declared in the current scope" has appeared. I'm not sure why this is, as I have been unable to find any references or resources online which show this as one of the changes between 3 and 4. Admittedly, I'm fairly new to Godot and programming in general, so maybe it's a fairly obvious solution, I don't know.

Anyways, here is what is causing the error:

func spawn_effect(effect: PackedScene, effect_position: Vector2 = global_position):
	if effect:
		var EFFECT = effect.instantiate()
		get_tree().current_scene.add_child(EFFECT)
		EFFECT.global_position = effect_position
		return EFFECT

Please use code tags with your posts so it's easier to read, makes a huge difference for people when debugging problems, also, I haven't been tinkering all that much with Godot 4 in 2D admittedly but I think you're using global_position wrong. This is just my personal preference as well but I'm not a fan of that style of coding where you dump a ton of variables in a function when you can access them just as well from the top.

To me you should be doing something like?

var effectPosition = global_position

Then call effectPosition that way, no need for explicit declarations in GDScript unless you've got a specific reason for it, looking at it a bit more I think you've done something odd possible with your PackedScene stuff too.

Edit: This is how I did pre-loaded scenes in Godot 4.

var plasmaBulletHole = preload ("res://plasma_bullet_hole_node.tscn")

Edit 2: Now that caffeine has kicked in I think you've mainly just declared the global position wrong which is why you're getting the error, the engine seems to think you're declaring it as a custom variable.

global_position does work in v4, it's more likely your packed scene isn't loading

open that scene in the editor and check it for errors