Quick Answer:
from pymel import * # Is the object.attr a source of a connection? len(object.tx.inputs()) > 0 # Is the object.attr the destination of a connection? len(object.tx.outputs()) > 0 # List an object.attr's source connection, meaning, list the input connection. # This will return a single object.attr. object.tx.inputs() # List an object.attr's destination connection, meaning, list the all output connections: # This could return multiple object.attrs. object.tx.outputs() # In other words, you can just use inputs() and outputs() to get if there is a connection # (source or destination), how many connections there are, and what they are! The following is the quotation of post from mel wiki .
...