Other actor's function

Sorry if this question was. Just starting to learn the engine. There is a cube-player(Pawn), there is a door(Pawn). How to play the cube to press the button and open the door? If I call GEngine-messages directly, everything works. But when directly changing the rotation of the door writes an error ‘this == nullptr’. I use the import of the door to the cube-player and call the opening function in cube-player:

#include “Door.h”

class ADoor* Door;

void ControlDoorFromCube()
Door -> OpenDoor();

What should I do to make it work?

you need to pass pointer of the door first

Thanks for the answer. A solution is found. Simple import and calling the open function directly worked.