[Python] How to call a function wrapped inside click from another code

Discussão em 'Python' iniciado por Stack, Maio 26, 2025.

  1. Stack

    Stack Membro Participativo

    I have a python function which would like to call another function wrapped inside click.

    So something like this:

    @click.command()
    @click.argument('expected', type=click.Path('r'))
    @click.argument('observed', type=click.Path('r'))
    @click.option('-o1', '--option1', default=None)
    @click.option('--option2', type=click.INT, default=0)
    main_compare(expected, observed, option1, option2):
    ......
    ...


    and I am calling it inside another function (in another .py file) like this:

    def callingFunction():
    main_compare(["expected",input_data_file, "observed", output_file, "--option1", option1, "--option2", option2])



    Is this is the right way to call it? I am getting some errors. Can someone confirm the right way to call such a function wrapped inside click?

    Thanks

    Continue reading...

Compartilhe esta Página