From: "Steve P." Date: 2010-07-27T03:40:44+09:00 Subject: Confused with "include" and require I am getting an error when I include or require a file. My code was getting too long for one file, so I attempted to separate out one section into another file, and then "load" the file into the main file at the appropriate place. The main body of my ruby script is /home/holocene/ruby/q.rb The load'ed file is /home/holocene/ruby/questionsaddquestions.rb The error I am getting is: /home/holocene/ruby/questionsaddquestions.rb:10: undefined local variable or method `statequestions' for main:Object (NameError) from ./q.rb:44:in `load' from ./q.rb:44 The code before the load, creates the instance "statequestions", and the code in the load'ed file acts upon the instance "statequestions". The error tells me that the loaded text does not know the instance has been created. (Proved because when I re-insert the loaded text, and # out the load, it works) Why am I getting an error? I thought "load" essentially is a substitute for keyed text, as opposed to 'require'. Best Regards, Steve. -- Posted via http://www.ruby-forum.com/.