# Is there a way to 'unload' a script/module/class?

**URL:** <https://rubytalk.org/t/is-there-a-way-to-unload-a-script-module-class/5029>\
**Category:** ruby-talk\
**Created:** [6 March 2003 15:36 UTC](https://rubytalk.org/t/is-there-a-way-to-unload-a-script-module-class/5029 "2003-03-06T15:36:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bennett\_Patrick](https://avatars.discourse-cdn.com/v4/letter/b/85e7bf/32.png) [@Bennett\_Patrick](https://rubytalk.org/u/Bennett_Patrick)\
**Post date:** [6 March 2003 15:36 UTC](https://rubytalk.org/t/is-there-a-way-to-unload-a-script-module-class/5029/1 "2003-03-06T15:36:43Z")

</div>

I’ve got a Ruby script that acts as a ‘launcher’ of sorts for a C++  
program of mine.  
The C++ program starts the ruby script, then communicates with it  
through a TCP/IP socket.  
One of the things it can do is tell the Ruby script to load a specific  
Ruby script (via ‘require’) and call a method of a known class name that  
will be defined within that file.  
It all works great, but the only problem is, if the user wants to change  
that ‘called’ script, then the changes will never be picked up since the  
’launcher’ script will only load that  
Script once (via the require).

Is there a way to effectively ‘unload’ a class so that a subsequent  
require will cause it to be reloaded (with any new changes that have  
been made) ?

Thanks,  
Patrick Bennett

---

<div class="post-metadata">

**Author:** ![ts1](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@ts1](https://rubytalk.org/u/ts1)\
**Post date:** [6 March 2003 15:42 UTC](https://rubytalk.org/t/is-there-a-way-to-unload-a-script-module-class/5029/2 "2003-03-06T15:42:07Z")

</div>

> One of the things it can do is tell the Ruby script to load a specific  
> Ruby script (via 'require') and call a method of a known class name that

use 'load' rather than 'require'

Guy Decoux
