Find Module containing Proc


Is it possible in RAPID to check if a certain PROC is defined and if so get the name of the module in which it is defined?

We are loading a module from a file using the Load instruction ("Load Test1.mod").
But in some cases it is possible that a module is still loaded ("Test2.mod") which contains a PROC with a name also defined in the module we are trying to load.

Here the (pseudo) code:

procName = "TestProc";
! Check module with PROC exists and delete if so
If <CheckHere> THEN
     EraseModule "<NameOfModule>";

! Load module and run the PROC
Load "Test1.mod"

We hoped to achieve it with the SetDataSearch i.c.w. the GetNextSym but were not able to find a PROC by name let alone finding the module it is defined.

We hope something like this is possible in RAPID  :).


  • lemster68
    lemster68 United States ✭✭✭
    Can you make those offending routines local to their respective modules and still retain the desired functionality?
    Lee Justice
  • Micky
    Micky Germany ✭✭✭
    Unfortunately, there is no function in RAPID to determine if a routine already exists. You can only check if a module exists.

    As already suggested by lemester68, you could declare the routines locally, so that several routines with the same name can exist in the robot system without causing error messages.

    The call of the routine via late binding looks like this:
    The module name and the routine name are separated by a colon.

  • You can try to use the ERRNO to check that.

    Like this example maybe:

        ! You need that when the routine is local declared in other module
        ! You can use this when the routine is gloable declared
        ! example
          ! here you can made the error handling with RAISE or RETRY or other logic.

    Maybe is helpfully.

    Take care.