# Invalid method code length

**URL:** <https://forum.inductiveautomation.com/t/invalid-method-code-length/10677>\
**Category:** General Discussion\
**Created:** [October 27, 2015, 11:15am UTC](https://forum.inductiveautomation.com/t/invalid-method-code-length/10677 "2015-10-27T11:15:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [October 27, 2015, 11:15am UTC](https://forum.inductiveautomation.com/t/invalid-method-code-length/10677/1 "2015-10-27T11:15:50Z")

</div>

Hi,  
I’m just coding a Gateway Timer Script. After a big bunch of code, I’m getting the error you can see in the following screenshot when I try to apply new changes

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/9621469929e18c2d7c00dff32d02b779c801321f.JPG)  
  
Does this mean I have reached the maximum number of lines per one script? Shall I break the script in two or more scripts, each running at a 2000 ms rate?

Thank you in advance,  
regards

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 27, 2015, 12:04pm UTC](https://forum.inductiveautomation.com/t/invalid-method-code-length/10677/2 "2015-10-27T12:04:04Z")

</div>

If I recall correctly, event scripts are limited to 4k characters. Consider putting the bulk of your code in a function in a project script module and calling that from your event script.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 27, 2015, 3:35pm UTC](https://forum.inductiveautomation.com/t/invalid-method-code-length/10677/3 "2015-10-27T15:35:15Z")

</div>

Right, split your code into one or more methods.
