Try working with a more simplified version of your script that specifically isolates the problem you are seeing. That also helps others when you are asking for help. Here is a smaller version of your script, with the globals removes, some excess functions and buttons removed, and a few corrections: https://pastebin.com/ZLjNaxKc
- on_make_selection_button_clicked: I noticed that you aren't limiting the addAttr() to a specific selected_object when you are looping, so if you had more than 1 selection, it would always try to add to all. I've set it to add to the current object in the loop - on_new_selection_button_clicked: When you are looking up the existing_groups, you are grabbing every transform in the scene that ends with "_spaceGrp". But the rest of the code in that function seems to want to operate only on the selection. So I have updated the ls() to only find transforms in the current selection Other than that, if you want more help, please describe a specific list of steps to perform, what you expect to happen, and what you actually see happening as an error instead. Justin On Thu, May 11, 2023 at 5:18 AM SquashnStretch net < squashnstret...@gmail.com> wrote: > Thanks Justin for your time. > Good to know about globals can cause issue.... > Anyways I tried not to use those, but I keep getting errors....I'll try to > understand better how to do, maybe I'll create also a global class. > THanks again > > F > > Il giorno mercoledì 10 maggio 2023 alle 10:36:29 UTC+1 Justin Israel ha > scritto: > >> >> >> On Wed, 10 May 2023, 8:40 pm SquashnStretch net, <squashn...@gmail.com> >> wrote: >> >>> great, let me know if you can take a look at it. >> >> >> >> I only took a quick look. It seems like you don't even need globals >> (unless I missed something). If you get rid of the extra printing code, >> what is left is the first two button callbacks that app and they get their >> own selection list each time. >> Mutable globals as state are a good way to end up with bugs. It is better >> to try and pass data between functions as args. Or to use a class so that >> each instance can store state. But maybe just getting rid of globals in the >> first place is enough here. There is even one of those functions where the >> selection list isn't declared global so it's a local list in that scope. >> There may be actual bugs in the Maya commands code but I didn't look >> closely enough. >> >> >> >>> Thanks in advance >>> Filippo >>> >>> >>> >>> Il giorno mercoledì 10 maggio 2023 alle 08:22:57 UTC+1 Justin Israel ha >>> scritto: >>> >>>> >>>> >>>> On Tue, 9 May 2023, 9:45 am SquashnStretch net, <squashn...@gmail.com> >>>> wrote: >>>> >>>>> oh damn, sorry.... >>>>> can you retry please ? >>>>> >>>> >>>> Oops forgot to reply. Yes it's accessible now. >>>> >>>> >>>>> thanks >>>>> F >>>>> >>>>> Il giorno lun 8 mag 2023 alle ore 22:35 Justin Israel < >>>>> justin...@gmail.com> ha scritto: >>>>> >>>>>> >>>>>> >>>>>> On Tue, May 9, 2023 at 8:56 AM SquashnStretch net < >>>>>> squashn...@gmail.com> wrote: >>>>>> >>>>>>> In my previous post, I asked for help understanding how to connect >>>>>>> different nodes from different elements all at once. I managed to work >>>>>>> around the problem by connecting the attributes one by one, which >>>>>>> seemed to >>>>>>> work. >>>>>>> >>>>>>> Now, I have another, easier problem for experienced Python users. >>>>>>> Let me try to explain. >>>>>>> >>>>>>> I am trying to write a code that adds a new space attribute to the >>>>>>> arm of a rig, connecting to the Head, Hips, and Body if they don't have >>>>>>> this option. If I add one space option to the right arm at a time, the >>>>>>> script works well. However, if I add a space to the other arm and then >>>>>>> go >>>>>>> back to the first arm to add another space, the script fails. >>>>>>> >>>>>>> I think it may be a matter of some global variable, but even when I >>>>>>> try to update it, I end up breaking the script. If you have the time, I >>>>>>> would appreciate it if you could take a look at my code. If you want to >>>>>>> test it, you can probably use any Maya rig. >>>>>>> >>>>>>> Thanks in advance >>>>>>> Filippo >>>>>>> >>>>>>> https://pastebin.com/embed_js/GaudeMpR >>>>>>> >>>>>> >>>>>> This pastebin is reporting that it's either private or pending >>>>>> moderation. Make sure you set the pastebin to public. >>>>>> >>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "Python Programming for Autodesk Maya" group. >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>> send an email to python_inside_m...@googlegroups.com. >>>>>>> To view this discussion on the web visit >>>>>>> https://groups.google.com/d/msgid/python_inside_maya/c92c073f-47d5-4d5a-93c6-06171bf81c5cn%40googlegroups.com >>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/c92c073f-47d5-4d5a-93c6-06171bf81c5cn%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>>> . >>>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Python Programming for Autodesk Maya" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to python_inside_m...@googlegroups.com. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0vVjVM74WL1Cgi9gxNFm4YSyYugcS-G0rNhcBWn%3DtEtQ%40mail.gmail.com >>>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0vVjVM74WL1Cgi9gxNFm4YSyYugcS-G0rNhcBWn%3DtEtQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Python Programming for Autodesk Maya" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to python_inside_m...@googlegroups.com. >>>>> >>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/python_inside_maya/CAE8PYnDc3S7%2BMzdzNYg9wo_Tgk0SvUaFxGN2ATN%3DTThrYbQ_Lg%40mail.gmail.com >>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAE8PYnDc3S7%2BMzdzNYg9wo_Tgk0SvUaFxGN2ATN%3DTThrYbQ_Lg%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Python Programming for Autodesk Maya" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to python_inside_m...@googlegroups.com. >>> >> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/python_inside_maya/03f28d7f-e87e-4573-8cbd-e33dfaa44b1an%40googlegroups.com >>> <https://groups.google.com/d/msgid/python_inside_maya/03f28d7f-e87e-4573-8cbd-e33dfaa44b1an%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to python_inside_maya+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/d19a7408-97a0-4211-be5c-2757e3154d6bn%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/d19a7408-97a0-4211-be5c-2757e3154d6bn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1wkUCXvausyyJQFuOpT0WOiE1_6BPi6tQCVofNwifOHw%40mail.gmail.com.