I am working on this code from the post: How can I run blender from command line or a python script without opening a GUI?
I am trying to open a blend file and have a script run in that blend file to do some actions.
but I get error while running this code from the above post
import bpy
import subprocess
f_path = 'C:/Users/naman/Desktop/test.blend'
code = """
import bpy
for obj in bpy.data.objects:
print(obj.name)
"""
output = subprocess.check_output( f"blender '{f_path}' -b --python-expr '{code}' ", shell =
True)
print(output.decode('UTF-8'))
