How to pass arguments and python module to Natron in cmd? Bug?

Hi there have been trying to run a simple script where i pass arguments into Natron along with python module. Ideally via sys.argv

Natron.exe -b myModule.py arg1

I’m executing most of this from subprocess though i have tested raw cmd just to make sure.

I also attempted -c (or --cmd) with an arg but also didnt work.
I tried various other methods that are more standardized for this type of thing.

Is this even possible?

Bare in mind that there is NO .ntp file at this point. The script does most of the work once in Natron.

Also it seems that natron ignores

if __name__ == '__main__':
    ....stuff

and rather access via this method

def createInstance(app, group):

Which is fine however i cant get any variables into this method.

Appreciate any help!

So its pretty hacky but one option is to pass the data you need in the env vars…

Setup your env var (this could even be a stringified json blob) and pass in:

cmds = ['Natron.exe', '-b', 'myModule.py']
os.environ['MY_TEST_VARIABLE'] = 'data...'
subprocess.run(cmds, env=os.environ.copy(), shell=True)

And then in myModule.py

def createInstance(app, group):
    value = os.environ.get('MY_TEST_VARIABLE')
    // Do stuff with my value...

Keen to know if people have had success with some other option.