The isinstance comparison is working:
resnet18 = models.resnet18(pretrained=True)
resnet18.fc = nn.Linear(512, 10) 

for module in resnet18.modules():
    if isinstance(module, nn.Linear):
        print(module)

> Linear(in_features=512, out_features=10, bias=True)

as it returns the only nn.Linear layer in the model.
However, note that modules will be called recursively on your main model.
E.g. the first result will be the parent ResNet class.
If you call module.parameters() you will get all parameters of the model, including the parameters of the linear layer.