Python Multi threading

Hello everyone,

I was coding a simulation in Blender using bpy. Everything seemed to run perfectly until I introduced Multi_Threading. The UI is getting freezed when i run the code fragment. and error it says
AttributeError: ‘NoneType’ object has no attribute ‘objects’ for line

def process_data(threadName, q, frameNumber)-> int:
while not exitFlag:
if not workQueue.empty():
data = q.get()
frameNumber = runWarehouse(threadName, data, frameNumber)
print ("%s processing %s" % (threadName, data))

def runWarehouse(nameRobot, nameReck, frameNumber) -> int:
objRobot =[nameRobot]
objReck =[nameReck]
{Some code running from here}

I am totally new to Blender programming. Not sure if threading support is available for blender
If anyone can help on this will be welcome Thanks in advance

I’m too lazy to wade through your unformatted code but…

Python threading is a bit peculiar due to the presence of something called the Global Interpreter Lock (GIL). Long story short, this means you can have multiple threads, but only one is running at a given time. This is a bit different from typical threading models.

The Python guys recommend using multi-processing instead of threading is you really, really, need concurrency.

Please see:

1 Like