Question: Hi everyone, i would like to know why this code works

```
from pygame.locals import *
print QUIT

```

and this don't works

```
import pygame
print pygame.locals.QUIT

```

Answer: 
`locals` is a nested sub-package of `pygame`, you'll have to import it first:

```
import pygame.locals

```

It is *not* an attibute of `pygame` itself; that only works if the `pygame/__init__.py` file itself were to do `from . import locals`.
You have to import `pygame.locals`, not `pygame`. Modules inside a package aren't automatically imported just because you import the package.