Backtick expansion, e.g. expression like `@attrib`, are not part of the Python script. They're part of Houdini's string parameter evaluation, and get filled in when PDG evaluates the script parm on the node and stores the script contents on the work item. That occurs when the work items are being generated. If the attribute doesn't exist when the item is being generated, then the @attrib access will evaluate to nothing.
You can also use pdg.workItem() to access attributes. That returns back an attribute object, such as a pdg.AttributeFloat [www.sidefx.com] – the type of the object it returns depends on the type of the attribute. You can then use the array bracket operator to access values, for example: