Help, why can't I use imported types?
I have a file called `shared.ksy`:

````yaml
meta:
  id: shared
  title: Postgres Protocol (Frontend & Backend)
  endian: be
types:
  copy_data:
    seq:
      - id: copy_data_stream
        size-eos: true
  copy_done:
    seq:
      - id: this_is_always_empty
        size-eos: true
````

And a file called `frontend.ksy`:

````yaml
meta:
  id: frontend
  title: Postgres Protocol (Frontend)
  endian: be
  imports:
    - shared
seq:
  - id: messages
    repeat: eos
    type: message
types:
  message:
    seq:
      - id: msg_type
        type: str
        encoding: ASCII
        size: 1
      - id: len
        type: u4
      - id: body
        size: len - 4  # the length includes itself
        type:
          switch-on: msg_type
          cases:
            '"Q"': simple_query
            '"d"': shared::copy_data
            '"c"': shared::copy_done
  simple_query:
    seq:
      - id: query
        type: strz
        encoding: ASCII
````

This compiles. However, when I parse messages which belong to one of the shared subtypes, I get back structs of type `Shared`, not of `CopyData` or `CopyDone`. The code generator does this:

````python
        def _read(self):
            self.msg_type = (self._io.read_bytes(1)).decode(u"ASCII")
            self.len = self._io.read_u4be()
            _on = self.msg_type
            if _on == u"Q":
                self._raw_body = self._io.read_bytes((self.len - 4))
                io = KaitaiStream(BytesIO(self._raw_body))
                self.body = self._root.SimpleQuery(io, self, self._root)
            elif _on == u"d":
                self._raw_body = self._io.read_bytes((self.len - 4))
                io = KaitaiStream(BytesIO(self._raw_body))
                self.body = Shared(io)  # This should be CopyData
            elif _on == u"c":
                self._raw_body = self._io.read_bytes((self.len - 4))
                io = KaitaiStream(BytesIO(self._raw_body))
                self.body = Shared(io)  # This should be CopyDone
            else:
                self.body = self._io.read_bytes((self.len - 4))
````

What am I doing wrong?

---

I also tried not using "shared::type" notation and using the types directly:

````yaml
  - id: body
    size: len - 4  # the length includes itself
    type:
      switch-on: msg_type
      cases:
        '"Q"': simple_query
        '"d"': copy_data
        '"X"': terminate
        '"c"': copy_done
````

But that gave me an error:

````
$ ksc --target python *.ksy --python-package .
/types/message/seq/2/type/cases/Str(d): unable to find type 'copy_data', searching from frontend
````