Hello everyone,
I've encountered the strangest issue while setting up a system using bots.
This simple diagram illustrates my setup.

There are 2 routes. Either one works fine by itself. The grammars correctly validate the corresponding messages.
If, however, I activate both routes, the second one (bottom) fails with a bunch of errors in the input file. These errors lead me to believe that bots is using "csv grammar 1" to validate the input messages that should be in "csv grammar 2".
I know this description is vague, so I'm attaching a plugin that contains the minimum setup for the issue to occur.
Update:
I found a solution but advice would still be greatly appreciated.
The issue seems to arise from my definition of the csv grammars. Both of them import syntax and structure from a third file (refer to plugin archive). If I remove the third file and paste syntax and structure directly into both grammars, the problem is solved.
Before:
# mexal_csv.py
from bots.botsconfig import *
syntax = {
...
}
structure = [
...
]
# order_response_message_mexal_csv.py
from bots.botsconfig import *
from mexal_csv import syntax, structure # <--- The culprit
recorddefs = {
...
}
After:
# order_response_message_mexal_csv.py
from bots.botsconfig import *
syntax = {
...
}
structure = [
...
]
recorddefs = {
...
}
From reading the documentation and the example files, I was under the impression that this reuse of grammar parts was admissible. I think the documentation almost exactly covers this use case
here where it says:
> A section can be reused/imported from another grammar file. Purpose: better maintenance of grammars.
Example: edifact messages from a certain directory use the same recorddefs/segments:
> from recordsD96AUN import recorddefs
If this is not possible because of the issue in question, how may I reuse these parts of the grammar without duplication?
I know this is a handful so thank you for the attention.
Sincerely,
Alessandro Rubino