Snakemake version
tested with :
8.10.8
7.32.3
Describe the bug
I have a snakefile using the Rule object to reference outputs from previous rules.
I have a second snakefile in which I want to import some of the rules from first snakefile.
Doing so, Snakemake raises a WorkflowError, that is not raised if I use strings for inputs/outputs instead of using input: rules.somerule.output
Logs
WorkflowError in file imported.smk, line 8:
Rule a is not defined in this workflow. Available rules:
Minimal example
You can create the 2 following files to recreate the bug :
# main.smk
module imported:
snakefile: "imported.smk"
rule a:
output: "a.from_main.txt"
shell: "touch {output}"
use rule b from imported as b with:
input: rules.a.output
rule target:
input:
rules.b.output
# imported.smk
rule a:
output: "a.from_imported.txt"
shell: "touch {output}"
rule b:
input: rules.a.output
output: "b.txt"
shell: "touch {output}"
rule target:
input:
"b.txt",
And run :
snakemake -s main.smk target -n
doing the following change to imported.smk fixes the error
rule b:
# input: rules.a.output
input: "a.from_imported.txt"
output: "b.txt"
shell: "touch {output}"