How to append a geometry-nodes node group using python

How can I import a geometry-nodes node group using python?
I have added the code below for demo purposes, and to explain my question.
I am trying to append a node group named “test” from a blend file named test, but I got caught in an error in the file path perhaps, as when the operator is executed it shows the error of test(blend file) does not exist.
I have tried this -

import os
import bpy

from bpy.types import (
from bpy.props import (

bl_info = {
    "name": "Geonode tree",
    "description": "Imports Geometry Node tree",
    "author": "Rakesh",
    "version": (1, 0),
    "blender": (3, 0, 0),
    "location": "Node Editor > Properties Panel",
    "warning": "",  # used for warning icon and text in addons panel
    "tracker_url": "",
    "category": "Node"

# ------------------------------------------------------------------------
#    Append Operator
# ------------------------------------------------------------------------

class NG_OT_Append(Operator):
    bl_idname = "ng.append_node_tree"
    bl_label = "Append NG"
    bl_options = {'REGISTER'}

    blend : StringProperty(name="Library Blend File")
    ng_name : StringProperty(name="Node group Name")

    def poll(cls, context):
        ob = context.active_object
        return ob is not None and ob.type == 'MESH'

    def execute(self, context):

        ob = context.active_object

        if ob is None:
  {'ERROR'}, "No active object")

        if ob.type != 'MESH':
  {'ERROR'}, "Active object is not a mesh")
            return {"CANCELLED"}

        # os.path.abspath(__file__) returns path to the addon
        filepath = os.path.join(os.path.dirname(
            os.path.abspath(__file__)), self.blend)

        # -> Test whether the file exist
        if not os.path.isfile(filepath):
  {'WARNING'}, "{} does not exist".format(self.blend))
            return {'CANCELLED'}

        with, link=False) as (data_from, data_to):
            data_to.node_groups = [
                name for name in data_from.node_groups if name.startswith("test")]

        # -> Test whether the object exist
        if not data_to.node_groups:
  {'WARNING'}, "{} not found in {}".format(
                self.ng_name, self.blend))
            return {'CANCELLED'}
       {'INFO'}, "Test Node tree added")
        return {'FINISHED'}

# ------------------------------------------------------------------------
#    Panel in Object Mode
# ------------------------------------------------------------------------

class NG_PT_mainPanel(Panel):
    '''Adds nodetree to active object'''
    bl_label = "NG"
    bl_idname = "NG_PT_mainPanel"
    bl_space_type = 'NODE_EDITOR'
    bl_region_type = "UI"
    bl_category = "NG"

    def draw(self, context):
        layout = self.layout

        file_name = "test"
        ng_name = "test"
        row = layout.row()
        row = layout.row()
        row.scale_y = 1.5
        props = row.operator(NG_OT_Append.bl_idname,
                             text="Add Node tree", icon='IMPORT')
        props.blend = file_name
        props.ng_name = ng_name

# ------------------------------------------------------------------------
#    Registration
# ------------------------------------------------------------------------

classes = (

def register():
    from bpy.utils import register_class
    for cls in classes:

def unregister():
    from bpy.utils import unregister_class
    for cls in reversed(classes):

if __name__ == "__main__":

Can anyone help me get this correct, and find the issue, where I am wrong?