Facing Issues When Importing a Python script into the Main Python Script

Mahesh_G
Mahesh_G Member Posts: 6
First Comment
**
edited March 2024 in Structures

I am new to programming and I am creating an app using ANSYS ACT.

My ExportImage script works well when I connect it directly to the XML file. However, if I run the same ExportImage.py file through MainScript.py, and MainScript is connected to the XML, then I encounter the following error.

Error when invoking function 'exportimage'.
Traceback (most recent call last):
File "C:\Users\AppData\Roaming\Ansys\v212\ACT\extensions\report\MainScript.py", line 14, in exportimage
File "C:\Users\AppData\Roaming\Ansys\v212\ACT\extensions\report\ExportImage.py", line 25, in exportimage
StandardError: Exception has been thrown by the target of an invocation.
Traceback (most recent call last):
File "C:\Users\AppData\Roaming\Ansys\v212\ACT\extensions\report\MainScript.py", line 14, in exportimage
File "C:\Users\AppData\Roaming\Ansys\v212\ACT\extensions\report\ExportImage.py", line 25, in exportimage
NameError: global name 'Ansys' is not defined

Also, same connectivity I verified with using by message box and it is working fine.

Please help me resolve this error.
Thank you in advance.

Answers