Accessing Blender (menu) functions from python?

HI,

Is it possible to call general blender functions from python, effectively turning the python script into a macro?

I want to automate the loading of VRML2 files into blender. Importing 10s to 100s of vrml files into one scene.

Ideally I would like to do something like this:

1 - Select the dir via GUI.
2 - Get a list of files in the dir.
3 - loop through all files
4 - Is the file a ‘.wrl’?
5 - If so, call ‘load file’ (same function used for menu file loading).
6 - post process imported data.

Can this be done?

Cheers Stephen