Trouble with setting correct context

I’m brand new to python and blender both, and i’m trying to write my first script. I have the script deleting an object and importing a new obj from a directory. Once the obj is imported, i would like to have it duplicated and have a decimate modifier applied to the duplicate so i can run a bake on it.

import os
import bpy

decimate = 0.02
resolution = '4k'


full_path_to_directory = os.path.join('C:\\', 'Users', 'brand', 'Desktop', 'New folder (2)')
file_list = os.listdir(full_path_to_directory)
obj_list = [item for item in file_list if item[-3:] == 'obj']

for item in obj_list:
    full_path_to_file = os.path.join(full_path_to_directory, item)


for ob in bpy.context.selected_editable_objects:
    ob.active_material_index = 0
    for i in range(len(ob.material_slots)):
        bpy.ops.object.material_slot_remove({'object': ob})

for ob in bpy.context.selected_editable_objects:
    bpy.context.object.modifiers["Decimate"].ratio = decimate
    bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Decimate")

bpy.context.scene.render.engine = 'CYCLES'
bpy.context.scene.selected_col = True
bpy.context.scene.selected_rough = True
bpy.context.scene.selected_normal = True
bpy.context.scene.texture_res = resolution
bpy.context.scene.restoreOrigUVmap = False
bpy.context.scene.newUVoption = True

If i remove the chunk that handles deleting the original object and imports the new obj from a folder, it passes without issues and applies the decimate modifier correctly. However, once i add in the part for importing the obj, the script breaks at the decimate modifier and i get this context error.

Traceback (most recent call last):
File “\Text”, line 28, in
File “C:\Program Files\Blender Foundation\Blender 2.81\2.81\scripts\modules\bpy\”, line 201, in call
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.object.modifier_add.poll() failed, context is incorrect
Error: Python script failed, check the message in the system console

I am completely new to this, so i apologize for any dumb or glaring mistakes im making here, any help is greatly appreciated. Thanks

But it does successfully import the new object at least?

Also if you paste your code inside 6 grave accent symbols like this 
    (3 above and 3 below [without the periods]) 
    it will format correctly on the forum and maintain its indenting.

Yes, the obj imports and gets a duplicate, but then the script breaks when it gets to the decimate modifier for the duplicate of the imported obj. And thank you for the tip on posting the script correctly, helps a lot.