MapInfo Pro Developers User Group

Welcome to the MapInfo Pro Developers community!  We are a group dedicated to the discussion and understanding of MapBasic and .Net MapInfoPro AddIn development. Bring your questions and ideas here. This group includes several members of the Pro development team from around the world.

Please feel free to start a discussion in the discussion tab or join in a conversation.

MapInfo Community Downloads

 View Only
  • 1.  How to pass a parameter from Python to a MapBasic procedure?

    Posted 09-19-2025 15:00
    Edited by Peter Møller 11-04-2025 03:26

    Hi,

    If I can, how do I pass a parameter to the "FromPython" (the one from example) MapBasic subroutine or function from python side? 

    It didn't work when I tried this 

                     thisApplication.CallMapBasicSubroutine("FromPython", 1)    # as a sub
    or 
                      thisApplication.CallMapBasicSubroutine("FromPythonFunc", 1)    # changed to a function. 
    can someone please help? Thank you. 



    ------------------------------
    Ferhad Pakzat

    BRITISH COLUMBIA HYDRO AND POWER AUTHORITY
    Burnaby BC
    ------------------------------



  • 2.  RE: How to pass a parameter from Python to a MapBasic procedure?

    This message was posted by a user wishing to remain anonymous
    Posted 09-19-2025 17:31
    This post was removed


  • 3.  RE: How to pass a parameter from Python to a MapBasic procedure?

    Employee
    Posted 11-04-2025 03:36
    Edited by Peter Møller 11-04-2025 03:40

    I looked at the documentation for CallMapBasicSubroutine in the Extensibility Reference:

    void CallMapBasicSubroutine(
    	string methodName,
    	params string[] parameters
    )

    The parameters need to be passed to the subroutine as a string array.

    The docs state:

    Parameters
    methodName
      Type: SystemString
      name of the mapbasic subroutine to call
    parameters
      Type: SystemString
      Parameters to the subroutine. Parameters are passed by value to the subroutine; if the subroutine accepts no arguments, then pass null.

    However, after reading this post, I realized that we may not support you passing multiple parameters as an array. The workaround is to concatenate your parameters into a single string separated by semicolons, and then split them in the procedure.

    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------