General

General

How to use external Python packages or modules into ANSYS Electronics Desktop?

    • FAQFAQ
      Participant

      To use external Python packages or modules in your scripts, you need to add the path to the folder where your package/module is to the system variable. Note: only modules for IronPython are accepted. You cannot use such modules as NumPy, etc To do so, you just need to add these following line codes: import sys sys.path.append(r”path to package/module folder”) import package/module Now you are able to use this package/module in your script. Example: >>> import sys >>> sys.path.append(r”E:ScriptsXlsxWriter-master”) >>> import xlsxwriter >>> dir(xlsxwriter) [‘Workbook’, ‘__VERSION__’, ‘__builtins__’, ‘__doc__’, ‘__file__’, ‘__name__’, ‘__package__’, ‘__path__’, ‘__version__’, ‘app’, ‘chart’, ‘chart_area’, ‘chart_bar’, ‘chart_column’, ‘chart_doughnut’, ‘chart_line’, ‘chart_pie’, ‘chart_radar’, ‘chart_scatter’, ‘chart_stock’, ‘chartsheet’, ‘comments’, ‘compatibility’, ‘contenttypes’, ‘core’, ‘drawing’, ‘format’, ‘packager’, ‘relationships’, ‘shape’, ‘sharedstrings’, ‘styles’, ‘table’, ‘theme’, ‘utility’, ‘vml’, ‘workbook’, ‘worksheet’, ‘xmlwriter’]