Get methods from module

I have something like this
module MyModule1
module MyModule2
def self.method1
end
def self.method2
end
end
end

I need to get the methods declared inside MyModule2 and I need the self.
to be able to access it like MyModule1::MyModule2.method1

If i try to get them like this:
MyModule1::MyModule2.instance_methods

nothing is captured but if i remove the self. yes I get the methods but
I need to use the self.

You didn’t define any instance methods. You will find your two methods
if you do a

MyModule1::MyModule2::methods

by doing that i get all methods not only the ones I created

Thanks a lot!!!

puts MyModule1::MyModule2::methods(false)

#method1
#method2

Ruby has no way to track “who” wrote the code to define a method : The
definition of a method can occur while executing or requiring something
from the Ruby stdlib, or some Gem, or some Code you wrote, and this type
of authorship is hard (maybe impossible) to track.

You can track all new methods added after a certain time in program
execution, by recording first a list of all methods, and later - when
you want to know the changes -, recalculate the list of methods and
output the difference. As a side effect, you also would get the methods
which have been removed from an object (a rare, but possible case).