I am interested in exporting and importing 3d models using blender via the command line, as mentioned in this question.
So now I want to know how I can import and export the models in blender with python using this method?
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.Sign up to join this community
Apart from the info that this question already gives you, you need to figure out the operators to call from the Python script.
Enable Python Tooltips (User Preferences -> Interface -> Display), then go to the import action in the File menu. Rather than clicking on it, hover your mouse over the menu item and inspect the tooltip. That'll tell you which operator to use. Do the same for the export, and you should have the information you need to build up your Python script.
You can get more help from the Python console (in the Scripting layout), by just typing the name of the operator. For example,
>>> bpy.ops.import_scene.obj will give you:
# Load a Wavefront OBJ File bpy.ops.import_scene.obj(filepath="", filter_glob="*.obj;*.mtl", use_ngons=True, use_edges=True, use_smooth_groups=True, use_split_objects=True, use_split_groups=True, use_groups_as_vgroups=False, use_image_search=True, split_mode='ON', global_clamp_size=0, axis_forward='-Z', axis_up='Y')
This tells you which options there are, and what the defaults are.