ports.PortReference

class ports.PortReference(port: Optional[int] = None, expected_type: Optional[type] = None)

Base class for port references.

If the port parameter is not supplied, then the port will be inferred. An inference will only succeed if there is exactly one port assigned to a reference of type expected_type. If expected_type is None, inference only succeeds if exactly one port is assigned. For the purpose of inference, the self() is not assigned to a port and will never be inferred.

name() str

Returns the user editable name of the controllable as found in the properties tab of the game.

from ports import PortReference

print(PortReference(0).name())