If yes, can you suggest a better way than below? Please elaborate/justify.

```
class X:
    ...

if __name__ == '__main__':
    # TODO: Should we bother doing this?
    errorMessage = 'This class is not meant to have a main method. Do not execute directly.'
    print(errorMessage)
    raise Error(errorMessage)

```