0

I am playing with IPython and I also tried this using and IDE but I can't figure out

I have module A when I do dir(A) I will get a list of strings containing the names of the methods, properties and child objects that the A module contains.

Let's say B is a child of A so the output of dir(A) is output=['B',....] Now I want to do dir(A.B) but B is a string and A is an object so I can't do dir (A+'.'+output[0]) since this will fail

How do I call dir(A.B) when B is contained in output[0]?

MiniMe
  • 1,057
  • 4
  • 22
  • 47
  • Don't think it is a duplicate; While it might partially give a clue it is not clear how I can use that since B is child object not an attribute of A – MiniMe Oct 20 '18 at 13:45
  • Turns out @Aran-Frey is right getattr is an unfortunate name but it does the job: dir(getattr(parentobjec,,strNameOfChildObject)) will do the trick thanks – MiniMe Oct 20 '18 at 14:01

0 Answers0