NoMethodError in pry after loading the file with the method

As shown in the picture, After entering pry and loading the file add.rb, I was able to use the method add(). However, when I tried to do the same with another file, NoMethodError showed. Any help is appreciated.