Load .blend file into Blender as Python Module [duplicate]

I am using Blender as a Python module. Now I am trying to load a scene into blender. Unfurtunately the obvious function bpy.ops.wm.open_mainfile(filepath) does not work as expected. The command fails saying:

Calling operator "bpy.ops.wm.open_mainfile" error, expected a string enum in ('INVOKE_DEFAULT', 'INVOKE_REGION_WIN', 'INVOKE_REGION_CHANNELS', 'INVOKE_REGION_PREVIEW', 'INVOKE_AREA', 'INVOKE_SCREEN', 'EXEC_DEFAULT', 'EXEC_REGION_WIN', 'EXEC_REGION_CHANNELS', 'EXEC_REGION_PREVIEW', 'EXEC_AREA', 'EXEC_SCREEN')

Can anyone explain to me how to load an existing .blend file when blender is used as Pyhton module?

This is a general operator calling issue, not related to using blender as a python module.

From the api docs on operators -

For calling operators, keywords are used for operator properties and positional arguments are used to define how the operator is called.

As you are giving a single positional argument it is interpreted by the operator as the execution_context value, which is meant to be a string from a defined enumeration of values, hence the error and the working solution that you found.

I found an answer to my question.

Problem was, that Python misinterpreted the passed argument filename. Assigning the argument filename as follows fixes the error.

filepath = "path\to\file.blend"
bpy.ops.wm.open_mainfile(filepath=filepath)