How can I separate a single object file into multiple objects based on closed geometry?
You could use Separate P (in Edit Mode) and select By loose parts.





The reverse operation would be Join Ctrl-J (in Object Mode) this would require all objects selected that you need to join to a single object.

In a script you could select the object by name and invoke the operator:

import bpy
object = bpy.data.objects['ObjectsName']
object.select = True
bpy.ops.mesh.separate(type='LOOSE')


After this you could set an individual origin to each separated object.

This can be accessed from the toolbar or from the menu:

Object -> Transform -> Origin to Geometry

To set the origin in a script you can select all objects and run:

bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN', center='MEDIAN')