In my code I am trying to open a new blender subprocess with this code
I am trying to do some action like this how to run a give code = ''' import bpy''' like in code below, in that new blender subprocess how to run like a script in that new sub process that opens Example Script : 'C:/Users/Desktop/my_script.py'
import bpy
import subprocess
blenpath = 'C:/Program Files/Blender Foundation/Blender 2.93/blender.exe'
code = '''
import bpy
for obj in bpy.data.objects:
obj.name = 'test_name'
'''
# how to run the code above in that new blender subprocess
# how to run like a script in that new sub process that opens
# Example Script : 'C:/Users/Desktop/my_script.py'
cmd = [blenpath]
subprocess.Popen(cmd)