Help i get this error RuntimeError: Operator bpy.ops.wm.alembic_import.poll() failed, context is incorrect [duplicate]

I think it's got some thing to do with opening a blend file and it not being able to carry on with the script.

import bpy

bpy.ops.wm.open_mainfile(filepath="Z:\\Projects\\Test\\blend\\template\\template.blend", filter_blender=True, filter_backup=False, filter_image=False, filter_movie=False, filter_python=False, filter_font=False, filter_sound=False, filter_text=False, filter_btx=False, filter_collada=False, filter_alembic=False, filter_folder=True, filter_blenlib=False, filemode=8, display_type='DEFAULT', sort_method='FILE_SORT_ALPHA', load_ui=True, use_scripts=True)

bpy.ops.wm.alembic_import(filepath="Z:\\Projects\\Test\\abc\\A\\box.abc", relative_path=True, as_background_job=False)

bpy.ops.wm.save_as_mainfile(filepath="Z:\\Projects\\Test\\blend\\A\\A.blend", check_existing=True, filter_blender=True, filter_backup=False, filter_image=False, filter_movie=False, filter_python=False, filter_font=False, filter_sound=False, filter_text=False, filter_btx=False, filter_collada=False, filter_alembic=False, filter_folder=True, filter_blenlib=False, filemode=8, display_type='DEFAULT', sort_method='FILE_SORT_ALPHA', compress=False, relative_remap=True, copy=False, use_mesh_compat=False)


• Please add a screenshot of the actual error message to your question. Also, if that's only a section of your python code, please include all of the relevant bits. As a guess, your problem is that you're not escaping '\' (backslash) characters. Either change you filepath strings to have \\ everywhere you now have \ or put an r in front of the opening double quote. Oct 21 at 22:15
• Added the image, I can run each line on it's own but the moment I open a scene and the import it gives me issues. Oct 22 at 7:12
• Dupe, different operator, same issue. Can copy the text of an error message from system console and post as text. (in a code bleck) blender.meta.stackexchange.com/questions/2788/… Oct 22 at 11:29
• Sorry, I wasn't aware. I was read screenshot and did exactly that. Oct 22 at 12:41