[Solved] Re-usable function [closed]


You could define aroot as a parameter, so you would have to pass your root in every time you call the function, if that is what you mean?

def SetERP(ArticleN, ERPn, aroot):
    for ERPRecord in aroot.iter('part'):
        if ERPRecord.get('P_ARTICLE_ORDERNR') == ArticleN:
            ERPRecord.set('P_ARTICLE_ERPNR', ERPn)

2

solved Re-usable function [closed]