# Clean code practice advice in ignition

**URL:** <https://forum.inductiveautomation.com/t/clean-code-practice-advice-in-ignition/76408>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [July 14, 2023, 7:31pm UTC](https://forum.inductiveautomation.com/t/clean-code-practice-advice-in-ignition/76408 "2023-07-14T19:31:27Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Felipe\_CRM](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@Felipe\_CRM](https://forum.inductiveautomation.com/u/Felipe_CRM)\
**Post date:** [July 14, 2023, 7:50pm UTC](https://forum.inductiveautomation.com/t/clean-code-practice-advice-in-ignition/76408/6 "2023-07-14T19:50:38Z")

</div>

> [@Cameron\_Nickle](#):
>
> calling a lot of different component properties (text fields and checkbox) in the script

Also, you can actually do this in the project library if you pass the component info to the function:

> [@Change button´s properties from script library](https://forum.inductiveautomation.com/t/change-button-s-properties-from-script-library/64618/2):
>
> If you want to do something like “programmatically alter all buttons the same way”, then I would suggest making a project library function that expects a particular component as the input. E.G: Project Library Script - utils def setColors(button): button.background = system.gui.color(251, 250, 249) Component Event Script utils.setColors(event.source.parent.getComponent('Button')) The crucial part is that you pass the component itself as a reference into your project script.

Useful if you plan to use that code for more than one component.

~~I forget if for Perspective you need to pass a session handle as well or not. Might depend on what exactly you're doing.~~  
EDIT: Passing the component (i.e. `self` from an event handler script) is enough to be able to modify prop values. Not sure what I was thinking about.

---

_[View the full topic](https://forum.inductiveautomation.com/t/clean-code-practice-advice-in-ignition/76408)._
