Want to make script that bakes all actions of a blend file

Hi!

I’m new to blender scripting but not to Python. I want to make a script that takes a blend file as input, and bakes all actions in that blend file. I need this because the game engine I am using can not solve inverse kinematics, but I want to use inverse kinematics when I create animations.

I’ve been looking at a few tutorials on how to create blender addons, and it’s a bit overwhelming. (Not that I want to create a blender addon in the sense that I want to be using in within blender. I want to be able to run my script without opening blender.) Being pointed in the right direction would be nice.

I know about the bake_action function, but how do I open a blend file and access the actions, as well as add new actions in the blend file?

EDIT: I just wanted to say that the way the script works, for example if it’s using blender on the command line, is running inside blender, or whatever, is not that important. I just want to automate the process of using bake action on all my actions.