OS Error Current ArcGIS Pro

Hello all!

It’s my first post here and I am relatively new in Python so I apologize if something is not in conformity. Hopefully, I can write the question clearly enough.

I have a project that I need to adapt to work with ArcGIS Pro. This code runs in FME PythonCaller using Python 2 working with ArcMap. Now I need to migrate to Python 3 which works with ArcGIS Pro.
I had to adapt only the part referring to library arcpy. Here is a part of the code:

import arcpy
import fme
import fmeobjects

class FeatureProcessor(object):
    def __init__(self):
        pass

    def check_layer_file(self, lyrPath):
        # Collect errors in list
        self.error_messages = []

        # Check whether the layer file is a group layer
        aprx = arcpy.mp.ArcGISProject("CURRENT")
        map_lyr = aprx.listMaps()[0]
        lyrs = aprx.listLayers(lyrPath)
        glyr = lyrs[0]
        if not glyr.isGroupLayer:
            self.error_messages.append("Message.")

        # Loop over all layers
        for lyr in lyrs:
            if not lyr.isGroupLayer: 

                # Check if all layers have a source
                if lyr.isBroken: # Returns True if a layer's data source is broken.
                    self.error_messages.append(
                        str(lyr) + " has a broken source.")

                # Check if layer is a feature layer
                if lyr.isFeatureLayer:
                    self.error_messages.append(
                        str(lyr) + " is a Feature Layer.")

                # Check for symbology type
                if lyr.symbologyType == "OTHER":
                    self.error_messages.append(str(lyr) + " unsupported.")

        return self.error_messages

However, whenever I run it I get an error message: Python Exception : CURRENT. I imagine the code assumes I am running it within ArcGIS Pro with a valid project open, which is not the case.
I have tried to swap “CURRENT” for the path of the layer but the same message continues to appear (Python Exception : filepath example.)

Does anyone have any idea how I can fix it?