Exporting OBJ in blender using script


I need some help exporting OBJ in blender, I have it working but I want the exporter to only export the selected object in the scene. As of now it is exporting everything else.

If anyone can help, that will be huge! Thanks :smiley:

Here is my code.
def add_object(self, context):
directory = ‘C:\Users\Arvin\AppData\Roaming\DigitalFossils\NVil\Media\Clipboard’
target_file = os.path.join(directory, file_export_name)

did you try using the use_selected flag for the export operator?

Thanks! Just started learning python and blender scripting, I understand what to do :slight_smile: