If the cell mentioned in equivalent_pins isn't there, the LVS script will stop. This function should be ignored if no cell/circuit with the given name is present.
Workaround:
Instead of using
equivalent_pins("ND2", "A", "B")
use
schematic.circuit_by_name("ND2") && equivalent_pins("ND2", "A", "B")
Nice to have BTW: "equivalent_pins" could appear before "schematic".