I renamed my form names from snake_case
to CamelCase
and changed all imports and variables names properly. Now, when adding a custom component with self.add_component
in a for
loop, the components are not visible. It was working before and only after I did the renaming did this happen. I tried:
- Checking
self.visible
- It’s True
- Duplicating the component and trying it- Same result
- Getting the
len
of self.get_components
to make sure they were added- They were added. 47 components.
I don’t know if this is a problem with my code or Anvil. Yesterday, I made a topic on how uplink suddenly stopped working (it’s still not fixed). Hopefully these problems get resolved soon.
Perhaps there is s conflict with the names.
In Python you usually name classes with CamelCase and object instances with snake_case. It is not a requirement, but it’s strongly advised.
Perhaps one of your form instances redefined a class.
I copied and pasted the code into a button click
event, and the code works. So it doesn’t work when the page form loads, yet it works when I click the button. You have any idea why thing could be happening? I am 100% certain the code is being run because I print
after every loop.
I think there are some conflicting names.
You can try to commit an older version and see where it stopped working.
Or you can post a clone link, so I can look at it.
Yeah, can I sent it to you via PMs?
Ok
(123456789… I need at least 20 characters)
@stefano.menci Found an issue in my code that was removing the components.
2 Likes