---
source: crates/ty_test/src/lib.rs
expression: snapshot
---
---
mdtest name: basic.md - Structures - Unresolvable submodule imports
mdtest path: crates/ty_python_semantic/resources/mdtest/import/basic.md
---

# Python source files

## mdtest_snippet.py

```
1 | # Topmost component resolvable, submodule not resolvable:
2 | import a.foo  # error: [unresolved-import] "Cannot resolve imported module `a.foo`"
3 | 
4 | # Topmost component unresolvable:
5 | import b.foo  # error: [unresolved-import] "Cannot resolve imported module `b.foo`"
```

## a/__init__.py

```
```

# Diagnostics

```
error[unresolved-import]: Cannot resolve imported module `a.foo`
 --> src/mdtest_snippet.py:2:8
  |
1 | # Topmost component resolvable, submodule not resolvable:
2 | import a.foo  # error: [unresolved-import] "Cannot resolve imported module `a.foo`"
  |        ^^^^^
3 |
4 | # Topmost component unresolvable:
  |
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

```

```
error[unresolved-import]: Cannot resolve imported module `b.foo`
 --> src/mdtest_snippet.py:5:8
  |
4 | # Topmost component unresolvable:
5 | import b.foo  # error: [unresolved-import] "Cannot resolve imported module `b.foo`"
  |        ^^^^^
  |
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

```
