# Code not being found when using module binaries

**URL:** <https://community.seqera.io/t/code-not-being-found-when-using-module-binaries/1264>\
**Category:** Ask for help\
**Created:** [October 7, 2024, 3:23pm UTC](https://community.seqera.io/t/code-not-being-found-when-using-module-binaries/1264 "2024-10-07T15:23:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Helen\_Curley](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/helen_curley/32/1119_2.png) [@Helen\_Curley](https://community.seqera.io/u/Helen_Curley)\
**Post date:** [October 7, 2024, 3:23pm UTC](https://community.seqera.io/t/code-not-being-found-when-using-module-binaries/1264/1 "2024-10-07T15:23:59Z")

</div>

Hi 👋  
I am trying to utilise the module binaries feature found [Modules — Nextflow documentation](https://www.nextflow.io/docs/latest/module.html).  
I have added

```auto
nextflow.enable.moduleBinaries = true

```

to my config.  
I have structured my module bin as per the above link.

```auto
module_name -> module.nf
            -> resources -> usr -> bin -> python_script1.py
                                       -> python_script2.py

```

and I am getting the error:

```auto
Command error:
  .command.sh: line 5: perform_SPRT_SMA_CAH_CF_RB1.py: command not found

```

and this is my script:

```auto
  script:
  """
    touch Description.DMD
    echo "Performing SPRT for ${meta.project_id}, disease is ${meta.description}, probeset is ${meta.probeset}" >> ${meta.project_id}_sprt.log
    perform_SPRT_SMA_CAH_CF_RB1.py -i ${workbook} -p ${meta.probeset} -d ${meta.description} -idx ${idxstats} -dup ${dup_metrics} -mf ${cf_gene_model_file} ${cah_gene_model_file_CYP21A1P} ${cah_gene_model_file_CYP21A2} ${rb1_gene_model_file} ${sma_gene_model_file_SMN1} ${sma_gene_model_file_SMN2} >> ${meta.project_id}_sprt.log
    """

```

This worked perfectly when my python scripts were in the overall workflow bin but is now failing when I’m trying to use the module bins. I really want this to work with module bins! Please help!  
I have ensured all python scripts in the new location are linux executable and I have checked my version of nextflow is compatible (using nextflow:22.10.4). Does anybody have any idea why this is failing?

---

<div class="post-metadata">

**Author:** ![mribeirodantas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mribeirodantas/32/235_2.png) [@mribeirodantas](https://community.seqera.io/u/mribeirodantas)\
**Post date:** [November 15, 2024, 12:50am UTC](https://community.seqera.io/t/code-not-being-found-when-using-module-binaries/1264/2 "2024-11-15T00:50:08Z")

</div>

Where are you running this pipeline, i.e. what’s the executor? I’m asking because if it’s on the cloud, you’d need Wave enabled.

You’re running into this error probably because the Nextflow script file for the module must be named `main.nf`, instead of your `module.nf`. I find the same error when naming it `module.nf`, but when I name it `main.nf`, I don’t run into the error you mentioned anymore. See my minimal reproducible example below:

```auto
.
├── main.nf
├── modules
│ └── hello_world
│ ├── main.nf
│ └── resources
│ └── usr
│ └── bin
│ └── hello.py
├── nextflow.config

```

Content of the `nextflow.config` file:

```auto
nextflow.enable.moduleBinaries = true

```

Content of the `main.nf` file:

```auto
include { HELLO_WORLD } from './modules/hello_world/main.nf'

workflow {
  HELLO_WORLD()
}

```

Content of the `main.nf` file in the module:

```auto
process HELLO_WORLD {
  debug true

  output:
  stdout

  script:
  """
    hello.py
    """
}

```

Content of the `hello.py` file:

```auto
#!/usr/bin/env python
print('Hello World')

```

Output when running the pipeline with the version you specified:

```auto
NXF_VER=22.10.4 nextflow run main.nf
Nextflow 24.10.0 is available - Please consider updating your version to it
N E X T F L O W ~ version 22.10.4
Launching `main.nf` [jovial_joliot] DSL2 - revision: e4ace67094
executor > local (1)
[f2/9bc9e9] process > HELLO_WORLD [100%] 1 of 1 ✔
Hello World

```
