How to assign PointerProperty in Operator through UI? I have multiple instances of class LayerSettings(bpy.types.PropertyGroup), which is simply a group of variables.  These are stored at the scene level (they're a predefined number, but many of them).  My operators work with different instances of the settings depending on which part of the UI they select (one button executes the operator with settings A, another does the same operator with settings B, etc.).

I'd like to pass the reference of the property group to these operators in the UI.

class SM_OT_image_calculator(bpy.types.Operator):

    layer: bpy.props.PointerProperty(type=LayerSettings)

    def execute(self, context):
        # use self.layer...


When I call the following in my panel:

layout.operator(SM_OT_image_calculator.bl_idname, text="Calculate Foreground").layer = layer_settings_arg


It gives me an error: attribute "layer" from "SM_OT_video_calculator" is read-only.  I can't find anything in the documentation or in StackExchange on how to assign properties (there's ones for a collection prop, but it has an add function that PointerProps don't).  I know hard-coding is an option for each instance, but that's hard to maintain and debug.

Is there a way to pass a reference of a property group instance to an operator, with the UI?
Aafter continuing researching, apparently operators can only take basic properties (e.g. string, bool, int, float), and PointerProperties only work if they’re stored within at the scene level (e.g. bpy.types.Scene) or inside a PropertyGroup.

So, short answer, it doesn't seem possible at this point (2.81a).

Anyways, my current workaround is making an EnumProperty on the panel that switches between the different instances of layers. Since the enum is stored at the scene level, all my operators can reference it freely and easily. It’s not as contained as I’d like, but it works.