MapInfo Pro Developers User Group

 View Only

Functionality of New_PythonAddin() and InitializePyAddin()

  • 1.  Functionality of New_PythonAddin() and InitializePyAddin()

    Posted 09-20-2023 05:45

    Hi,

    I'm trying to implement a custom MapBasic application written entirely in Python, I've created my MapBasic entry point into the Python code based off of the Python Ribbon example found in:

    \MapBasic\Samples\RIBBONINTERFACE\Python\py_ribbon_customization

    I had a few questions about the following functions:

    New_PythonAddin()

    InitializePyAddin()

    These are obviously used to load the Python module into the MapBasic environment and execute it. But why are they separate? What are the specific behaviours of New_PythonAddin(), does it just return an empty object to be initialised by InitializePyAddin()? Is there a way to specify the python module to be loaded? Why exactly do we need an empty object for the python module to have access to the MapInfo process if we are passing it a reference anyway in the second parameter of InitializePyAddin()?



    ------------------------------
    Romano Agostini
    Knowledge Community Shared Account
    ------------------------------