Take the two `%` out of this line `if '%Notes_SHLs%' in layer.dataSource:`

If you want to check if a specific string is within a variable, you need to exclude the `%` wildcard symbols

    if 'Notes_SHLs' in layer.dataSource: