Is there a way to do an engraving effect onto to an object?

Im trying to use boolean on a cube to “engrave” a model I created using Mirror mod and subdivision Mod and now boolean isnt working. I applied the mods but Im not sure if Im missing a step. I used the cube for boolean mod and clicked my model.

If you are doing it manually, you are most likely forgetting to click “Apply”:

Capture

If you are trying it with code, this is from a tutorial I did:

        bpy.ops.object.modifier_add(type='BOOLEAN')
        bpy.context.object.modifiers["Boolean"].operation = 'DIFFERENCE'
        bpy.context.object.modifiers["Boolean"].object = bpy.data.objects["crater"]
        bpy.ops.object.modifier_apply(modifier="Boolean")

The tutorial is here: https://www.archeuslore.com/blender/blender.html

Code for it is here if you want to see it in context.

import bpy
from mathutils import Vector, Matrix
import random
import math
from math import sin, cos

x=0; y=0; z=0;

# Move active object to origin is default, but can 
# be moved to any vector (x,y,z) coordinate
def set_pivot(coordinates=Vector()):
    ob = bpy.context.active_object
    mw = ob.matrix_world
    o = mw.inverted() @ Vector(coordinates)
    ob.data.transform(Matrix.Translation(-o))
    mw.translation = coordinates


# Now has an option to either deselect all, or keep other 
# things selected, which allows using this for doing booleans 
def obyname(name, deselectall=True):
    for ob in bpy.context.window.scene.objects:
        if(deselectall):
            ob.select_set(False)
            for obj in bpy.context.selected_objects:
                obj.select_set(False)
        if(ob.name==name):
            bpy.context.view_layer.objects.active = ob
            ob = bpy.context.active_object
            ob.select_set(True)
    return ob

    
# Moon project
moonradius = 6
def createmoon():
    bpy.context.scene.cursor.location = (0,0,0)
    bpy.ops.mesh.primitive_uv_sphere_add(segments=64, ring_count=64, radius=moonradius, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
    ob = bpy.context.active_object
    ob.name = "Moon"


def createcraters(cratercount=30):
    x = 0
    yval=0
    zval=0
    while(x<cratercount):
        # Create smaller sphere to make crater
        if((x%9)==0): # Create more smaller craters, every nineth crater is larger
            scale = random.randrange(11, 17)*.1 
            print("large crater")
        else: 
            scale = random.randrange(6, 10)*.1 
            print("small crater")
        craterdepth = scale * .36   # z-scale sets crater depth
        bpy.ops.mesh.primitive_uv_sphere_add(segments=16, ring_count=11, align='WORLD', location=(moonradius + .02, 0, 0), scale=(scale, scale, craterdepth))
        bpy.ops.transform.rotate(value=1.5708, orient_axis='Y')
        bpy.context.active_object.name = 'crater'
        set_pivot()
        if((x%6)==0):  # Every sixth crater can be closer to poles
            yval = random.randrange(-157, 157) * .01   # radians 1.57 = 90 degrees
        else:
            yval = random.randrange(-79, 79) * .01 # Create more in equatorial regions
        # Radians 1.57/2 = 45 degrees
        zval = random.randrange(0, 628) * .01  # 6.28 radians is one rotation
        if(zval>7):
            zval = 0
        bpy.ops.transform.rotate(value=yval, orient_axis='Y', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, True, True))
        bpy.ops.transform.rotate(value=zval, orient_axis='Z', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, True, True))
        # Note that here we are NOT de-selecting all so the crater part 
        # remains selected for the boolean operation
        ob = obyname('Moon', False)
        bpy.ops.object.modifier_add(type='BOOLEAN')
        bpy.context.object.modifiers["Boolean"].operation = 'DIFFERENCE'
        bpy.context.object.modifiers["Boolean"].object = bpy.data.objects["crater"]
        bpy.ops.object.modifier_apply(modifier="Boolean")
        ob = obyname('crater', True)
        bpy.ops.object.delete(use_global=False, confirm=False)
        x +=1


# If Moon has already been created, do nothing, skip if Moon exists.
# This allows you to add additional craters if you want more!
create = True  
for ob in bpy.context.window.scene.objects:
    if(ob.name=='Moon'):
        create = False

if(create):    
    createmoon()    


createcraters(20)