User bio
404 bio not found
Member since Jun 8, 2016
Replies:

Thanks! And nice tips and lovely explanation,  now everything is making more sense. 

Regarding the pure Python approach, I am still struggling with how to use it in a much simpler way. Your last example is still too complex for a very simple scenario of one or two python files. 

Let me explain. I have this class in the file hello_world.py

class HelloWorld:
    def sayhello(self):
        print("Hello, World!")
        return "you did it!"

Then I would like to use it doing something like: 

Class dc.boto Extends %RegisteredObject
{

ClassMethod test1() [ Language = python ]
{
    from hello_world import HelloWorld
    # Create an instance of HelloWorld
    greeting = HelloWorld()

    # Call the say_hello method
    ret=greeting.sayhello()
    print(ret)
}

ClassMethod test2()
{
    Set hello = ##class(%SYS.Python).Import("/iris-shared/python/hello_world.py")
    Write hello.sayhello()
}

}

But this is throwing ModuleNotFoundError errors. 

I don't know if I have to create a packet and import it with pip... if so, it will be still complex. 😌
Is this possible? Do you see my point?

I am not sure what you need or are looking for. If you want to list all the routines, you can do it by looping on the ^ROUTINE global. There are some other methods using System libraries to get this information. 

As a quick example, you can copy-paste the following code directly into the terminal to see if this is what you need: 

// In one line: 
SET routineName="" FOR  SET routineName=$ORDER(^ROUTINE(routineName)) QUIT:routineName=""  WRITE routineName, !

// More readable: 
SET routineName = ""
FOR {
    SET routineName = $ORDER(^ROUTINE(routineName))
    QUIT:routineName=""
    WRITE routineName, !
}
Open Exchange applications:
Certifications & Credly badges:
Mario has no Certifications & Credly badges yet.
Global Masters badges:
Followers:
Mario has no followers yet.
Following: