I can type


into the the console and get a return but when it is in this loop it sends back an error. please see image below. I must be calling it improperly but not sure why. any help is appreciated.


You're testing all of the objects that were selected when the script reached the line fbxs = [ ob for ob in bpy.context.selected_objects] One of these objects has no parent, so when the line ob.parent.select = True is run, Blender tries to find a parent and raises an error when it doesn't find one.

Try this instead:

if (ob.parent):

or if that doesn't work for some reason, enclose it in a try:/except: block.

  • $\begingroup$ That did it. Thank you really appreciate the help!!! $\endgroup$
    – Nburgess
    Aug 14 '19 at 16:12
  • 1
    $\begingroup$ It can be helpful to get into the habit of writing a print statement in every loop until you form an understanding of what exactly is in the list. It's better to have print statements you don't need than to be in the dark about what is causing an error. It's never safe to assume, and the computer always does exactly what you tell it to. Often, the hardest to squash bugs are in the part of the code you think is rock-solid! $\endgroup$ Aug 14 '19 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.