# Local Module Not Found

**URL:** https://forum.access-hive.org.au/t/local-module-not-found/6341
**Category:** Technical
**Tags:** help, community-help
**Created:** [29 April 2026 23:52 UTC](https://forum.access-hive.org.au/t/local-module-not-found/6341 "2026-04-29T23:52:36Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![reyhan.respati](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/reyhan.respati/32/4344_2.png) [@reyhan.respati](https://forum.access-hive.org.au/u/reyhan.respati)
#### Post date: [29 April 2026 23:52 UTC](https://forum.access-hive.org.au/t/local-module-not-found/6341/1 "2026-04-29T23:52:36Z")

</div>

Hi, I need some help with a python technical issue.

I have a working directory and set up an `env.sh` file listing local modules that I’m using within this directory:

```shell
#!/bin/bash

# Define some basic environmental variables before launching the suite

# Load the analysis3 conda environment
module purge
module use /g/data/xp65/public/modules
module load conda/analysis3

# Root directory for this repo
export ROOT=/home/565/${USER}/trop-wx-sys-predict # Change this to match where you clone this repo

# Append modules to our python path
export MODULES=${ROOT}/budget
export PYTHONPATH=${MODULES}:${PYTHONPATH}

export MODULES=${ROOT}/filter_mode
export PYTHONPATH=${MODULES}:${PYTHONPATH}

export MODULES=${ROOT}/track_cell
export PYTHONPATH=${MODULES}:${PYTHONPATH}

export MODULES=${ROOT}/submit_job
export PYTHONPATH=${MODULES}:${PYTHONPATH}

```

It’s been working without any problem for almost 2 years now, but today I’m encountering an issue when I try to run a python script. I did `source env.sh` then `python3 this_is_a_file_name.py`, and I got the following error message:

```python
Traceback (most recent call last):
  File "/home/565/mr4682/trop-wx-sys-predict/this_is_a_file_name.py", line 7, in <module>
    import submit_job
  File "/g/data/xp65/admin/analysis3/sitecustomize.py", line 72, in tracking_import
    mod = _real_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'submit_job'

```

I believe the module directories are already in my `PYTHONPATH`:

```shell
echo $PYTHONPATH

/home/565/mr4682/trop-wx-sys-predict/submit_job:/home/565/mr4682/trop-wx-sys-predict/track_cell:/home/565/mr4682/trop-wx-sys-predict/filter_mode:/home/565/mr4682/trop-wx-sys-predict/budget:/g/data/xp65/admin/analysis3:/home/565/mr4682/trop-wx-sys-predict/submit_job:/home/565/mr4682/trop-wx-sys-predict/track_cell:/home/565/mr4682/trop-wx-sys-predict/filter_mode:/home/565/mr4682/trop-wx-sys-predict/budget

```

However, when I tried importing in a python console, it worked:

```python
python3
Python 3.11.13 | packaged by conda-forge | (main, Jun 4 2025, 14:48:23) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Ctrl click to launch VS Code Native REPL
>>> import budget
>>> import submit_job
>>> 

```

I have tried using different versions of `conda/analysis3`, but none has worked so far.

Any help and advice to this issue would be greatly appreciated.

Thank you

---

<div class="post-metadata">

### Author: ![Scott](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/scott/32/37_2.png) [@Scott](https://forum.access-hive.org.au/u/Scott)
#### Post date: [30 April 2026 00:36 UTC](https://forum.access-hive.org.au/t/local-module-not-found/6341/2 "2026-04-30T00:36:18Z")

</div>

Is there a file `/home/565/mr4682/trop-wx-sys-predict/submit_job/ __init__.py`?

Otherwise there appear to be current connection issues with Gadi, might be a temporary disk outage

---

<div class="post-metadata">

### Author: ![reyhan.respati](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/reyhan.respati/32/4344_2.png) [@reyhan.respati](https://forum.access-hive.org.au/u/reyhan.respati)
#### Post date: [30 April 2026 00:43 UTC](https://forum.access-hive.org.au/t/local-module-not-found/6341/3 "2026-04-30T00:43:55Z")

</div>

Yes, I have the ` __init__.py`in `submit_job` module directory. It contains this:

```python
__name__ = "submit_job"
__all__ = ["submit", "check"]

from . import submit
from . import check

```

---

<div class="post-metadata">

### Author: ![Scott](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/scott/32/37_2.png) [@Scott](https://forum.access-hive.org.au/u/Scott)
#### Post date: [30 April 2026 00:57 UTC](https://forum.access-hive.org.au/t/local-module-not-found/6341/4 "2026-04-30T00:57:19Z")

</div>

Only other thing I can think of is make sure `sys.path` is reflecting what you’ve set in `$PYTHONPATH`

---

<div class="post-metadata">

### Author: ![Scott](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/scott/32/37_2.png) [@Scott](https://forum.access-hive.org.au/u/Scott)
#### Post date: [30 April 2026 01:03 UTC](https://forum.access-hive.org.au/t/local-module-not-found/6341/5 "2026-04-30T01:03:40Z")

</div>

Oh shouldn’t `PYTHONPATH=$ROOT`? You want it to be the parent directory of the module, not the module directory itself

---

<div class="post-metadata">

### Author: ![Aidan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/aidan/32/42_2.png) [@Aidan](https://forum.access-hive.org.au/u/Aidan)
#### Post date: [30 April 2026 01:57 UTC](https://forum.access-hive.org.au/t/local-module-not-found/6341/6 "2026-04-30T01:57:33Z")

</div>

Any reason not to use a [virtual environment](https://docs.python.org/3/library/venv.html)?

There is an example of how this might be done “on top” of a `conda/analysis3` environment in the CLEX CMS docs

> **[Building custom python environments on top of conda/analysis3 — CLEX CMS Blog](https://coecms.github.io/posts/2024-06-05-mixing-python-envs.html#virtual-environments)**
>
> The conda analysis environments in the hh5 project are a community-led approach to create a central python environment specifically for the analysis of climate and weather data. As such, these environments contain a wide range of packages curated by...

---

<div class="post-metadata">

### Author: ![atteggiani](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/atteggiani/32/212_2.png) [@atteggiani](https://forum.access-hive.org.au/u/atteggiani)
#### Post date: [30 April 2026 02:04 UTC](https://forum.access-hive.org.au/t/local-module-not-found/6341/7 "2026-04-30T02:04:13Z")

</div>

> [@reyhan.respati](#):
>
> However, when I tried importing in a python console, it worked:

The reason for this is most likely that you started the python console from your home directory where the local module is.  
Python also looks for files in the current directory to find modules to import, so in that case the module is imported correctly because it’s read from the current directory.  
If you try running the console from a different directory, I think it will fail.

I think the simple fix is what @Scott suggested

> Oh shouldn’t `PYTHONPATH=$ROOT` ? You want it to be the parent directory of the module, not the module directory itself

---

<div class="post-metadata">

### Author: ![reyhan.respati](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/reyhan.respati/32/4344_2.png) [@reyhan.respati](https://forum.access-hive.org.au/u/reyhan.respati)
#### Post date: [30 April 2026 02:30 UTC](https://forum.access-hive.org.au/t/local-module-not-found/6341/8 "2026-04-30T02:30:25Z")

</div>

HI all, thank you for your kind replies.

I tried @Scott’s suggestion, and now it works!

The reason I didn’t set `$PYTHONPATH=$ROOT` is because I just followed [this tutorial](https://21centuryweather.github.io/21st-Century-Weather-Software-Wiki/python/package-structure.html) when I set up the directory. Surprisingly, it always worked until today.

Thank you!
