# Grasshopper user objects -\> replacing in all grasshopper files

**URL:** <https://discourse.mcneel.com/t/grasshopper-user-objects-replacing-in-all-grasshopper-files/181003>\
**Category:** Grasshopper Developer\
**Tags:** windows, mac\
**Created:** [April 27, 2024, 3:30pm UTC](https://discourse.mcneel.com/t/grasshopper-user-objects-replacing-in-all-grasshopper-files/181003 "2024-04-27T15:30:25Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ed.p.may](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ed.p.may/32/508653_2.png) [@ed.p.may](https://discourse.mcneel.com/u/ed.p.may)\
**Post date:** [April 28, 2024, 1:12pm UTC](https://discourse.mcneel.com/t/grasshopper-user-objects-replacing-in-all-grasshopper-files/181003/2 "2024-04-28T13:12:31Z")

</div>

Hi @Petras_Vestartas

You might take a look at how the LBT folks do their component-swapout:

- [LB Sync Grasshopper File](https://github.com/ladybug-tools/ladybug-grasshopper/blob/master/ladybug_grasshopper/src/LB%20Sync%20Grasshopper%20File.py)
- [ladybug\_rhino.versioning.diff.sync\_component()](https://github.com/ladybug-tools/ladybug-rhino/blob/b3346d7439a990a5bf4b7125038af9a0aa9db7f8/ladybug_rhino/versioning/diff.py#L224C5-L224C19)

For me, a better method has been moving all of the logic of the component out to functions or classes in a package, and them importing those into the component. When you update the package’s logic, it also updates in all your GH-Files.

[@AndersDeleuran](https://discourse.mcneel.com/u/AndersDeleuran) had a good explanation of several other methods for managing your code [in a recent post here.](https://discourse.mcneel.com/t/python-component-in-multiple-gh-files-how-to-keep-updated/174263/5)

@ed.p.may

---

_[View the full topic](https://discourse.mcneel.com/t/grasshopper-user-objects-replacing-in-all-grasshopper-files/181003)._
