Does anyone know if we would like to import local ...
# ask-community
s
Does anyone know if we would like to import local module, which has the same module prefix, like "abc", to dagster locally, what cli option should we use? I encountered errors when trying to import modules with the same module prefix but in different directories. Unit tests are fine when import the same module. The repo file is under
abc/repo.py
but there is no
abc_dagster_common
under
abc
directory
Copy code
Stack Trace:
  File "/home/user_a/.pyenv/versions/3.10.9/lib/python3.10/site-packages/dagster/_grpc/server.py", line 290, in __init__
    self._loaded_repositories: Optional[LoadedRepositories] = LoadedRepositories(
  File "/home/user_a/.pyenv/versions/3.10.9/lib/python3.10/site-packages/dagster/_grpc/server.py", line 134, in __init__
    loadable_targets = get_loadable_targets(
  File "/home/user_a/.pyenv/versions/3.10.9/lib/python3.10/site-packages/dagster/_grpc/utils.py", line 37, in get_loadable_targets
    else loadable_targets_from_python_file(python_file, working_directory)
  File "/home/user_a/.pyenv/versions/3.10.9/lib/python3.10/site-packages/dagster/_core/workspace/autodiscovery.py", line 26, in loadable_targets_from_python_file
    loaded_module = load_python_file(python_file, working_directory)
  File "/home/user_a/.pyenv/versions/3.10.9/lib/python3.10/site-packages/dagster/_core/code_pointer.py", line 97, in load_python_file
    raise DagsterImportError(
The above exception was caused by the following exception:
ModuleNotFoundError: No module named 'abc.abc_dagster_common'
🤖 1
c
Hi Siyu. In order to import multiple modules, you could do something like:
Copy code
dagster dev -m your_module_name -m your_second_module
which would import each separate module as a code location. If you are still running into the error after this, would you mind sharing your folder structure with me so I can repro?
s
Hi Claire, thanks so much! I realize the issue is actually the dagit version is inconsistent with the dagster version.
c
Nice, glad you figured it out