You need to use a common Docker network. By itself compose creates an isolated network per file.
So you either need to create one manually in CLI and use external in both compose files or you create it in one compose file with attachable: true and name: and in the other one use external: true.