How to get a self module by its name

I split the pretrained VGG into slices.They are called slice1,slice2,slice3 and so on.But when I want to set some parts freezed while other trained.I can’t match these model by name.I tried to use

for i in range(1,6):

this doesn’t work.How to modify?

getattr(self, string)