Initializing help system before first use

Application Interface

Topics covered in this chapter:

The functions for interacting with the Insight server are provided by the xpressinsight.AppInterface class. The methods of that class can be used, e.g., for downloading and uploading attachments, and for getting scenario and application metadata.

You can access the application interface functions via the insight property of the Insight application. This property is inherited from the base class xpressinsight.AppBase. The following example code, can be used to upload an attachment from within the Insight application class:

    self.insight.put_scen_attach("attachment.txt")

Note that the Python keyword self represents the current instance of the Insight application class. The following example shows how to integrate this line of code in an application.

import xpressinsight as xi

@xi.AppConfig(name="Attachment Example")
class App(xi.AppBase):

    @xi.ExecModeLoad(descr="Uploads attachment.")
    def load(self):
        with open("attachment.txt", "w") as text_file:
            text_file.write("Hello!")

        self.insight.put_scen_attach("attachment.txt")
        print('Upload status:', self.insight.attach_status)

    @xi.ExecModeRun(descr="Downloads attachment.")
    def run(self):
        self.insight.get_scen_attach("attachment.txt")
        print('Download status:', self.insight.attach_status)

        if self.insight.attach_status == xi.AttachStatus.OK:
            with open("attachment.txt", "r") as text_file:
                print(text_file.readline())

© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.