After looking through the api documentation, it does not appear that there is a direct way to know which contexts an operator will work in.
Therefore, one way to determine this is to call an operator's poll
method in every context to see if the operator will work (brute forcing it). Using this approach, the bpy.ops.sequencer.duplicate
will work in the 'SEQUENCE_EDITOR'
context, and only the sequence editor.
The script below simply runs through all the areas and polls the operator (line 15).
import bpy
#all the area types except 'EMPTY' from blender.org/api/blender_python_api_current/bpy.types.Area.html#bpy.types.Area.type
types = {'VIEW_3D', 'TIMELINE', 'GRAPH_EDITOR', 'DOPESHEET_EDITOR', 'NLA_EDITOR', 'IMAGE_EDITOR', 'SEQUENCE_EDITOR', 'CLIP_EDITOR', 'TEXT_EDITOR', 'NODE_EDITOR', 'LOGIC_EDITOR', 'PROPERTIES', 'OUTLINER', 'USER_PREFERENCES', 'INFO', 'FILE_BROWSER', 'CONSOLE'}
#save the current area
area = bpy.context.area.type
#try each type
for type in types:
#set the context
bpy.context.area.type = type
#print out context where operator works (change the ops below to check a different operator)
if bpy.ops.sequencer.duplicate.poll():
print(type)
#leave the context where it was
bpy.context.area.type = area