How to reference spawned character in another class?

I’m currently trying to setup a 1 v 1 fighting game. My player character blueprint class is already setup as the default pawn class within gamemode and I have my AI opponent blueprint spawning via the level blueprint. The problem is when I try and grab the spawned AI opponent using the “get all actors of class” node within my player characters blueprint via the beginplay event I get an error saying:

“Accessed None trying to read property OpponentAI from function”

So its saying my opponent character cannot be found within the level when the ‘beginplay’ event on my player character runs. So how am I suppose to grab a reference to my spawned opponent from my player character blueprint class if my player character is getting spawned BEFORE my opponent?

Instead of doing this, just link the two with a local variable that you access. No need to get all of that class if it is one on one. Spawn both using blueprint and give each a reference to the other.