Custom iterator is not found if used in template function, if used from a third file
### Description

The following code doesn't compile with `nim r main.nim`:

main.nim:
```nim
import piecevalue

getPieceValue[int]()
```
piecevalue.nim:
```nim
import bitboard

func getPieceValue*[T]() =
  for square in 0.uint64:
    discard
```
bitboard.nim:
```nim
iterator items*(bitboard: uint64): int =
  discard
```


### Nim Version

Nim Compiler Version 2.1.9 [Linux: amd64]
Compiled at 2024-07-13
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: f6aeca5765bb48abc6efbe35e4ea6accf127d072
active boot switches: -d:release

### Current Output

```text
Hint: used config file '/home/tsoj/.choosenim/toolchains/nim-#devel/config/nim.cfg' [Conf]
Hint: used config file '/home/tsoj/.choosenim/toolchains/nim-#devel/config/config.nims' [Conf]
.......................................................................
/tmp/testtest/piecevalue.nim(1, 8) Warning: imported and not used: 'bitboard' [UnusedImport]
/tmp/testtest/main.nim(3, 14) template/generic instantiation of `getPieceValue` from here
/tmp/testtest/piecevalue.nim(4, 18) Error: type mismatch
Expression: items(uint64(0))
  [1] uint64(0): uint64

Expected one of (first mismatch at [position]):
[1] iterator items(a: cstring): char
[1] iterator items(a: string): char
[1] iterator items[IX, T](a: array[IX, T]): T
[1] iterator items[T: Ordinal](s: Slice[T]): T
[1] iterator items[T: char](a: openArray[T]): T
[1] iterator items[T: enum and Ordinal](E: typedesc[T]): T
[1] iterator items[T: not char](a: openArray[T]): lent2 T
[1] iterator items[T](a: seq[T]): lent2 T
[1] iterator items[T](a: set[T]): T
```


### Expected Output

```text
Should compile
```


### Possible Solution

_No response_

### Additional Information

When changing in main.nim the code to:
```nim
import piecevalue, bitboard

getPieceValue[int]()
```
it works.