Running code manually after script is loaded / executed


I’ve made an small add-on. It works nice, but I want to be able to create another script that should run methods from my add-on. Is this possible?

For example, my add-on has a method
but if I try to run it from the python console it does not work the same way than if I press a UI button on the add-on that fires it.

Also, how can I use parameters for these methods?

Can I use a Class I’ve created in this add-on?


class MyTools():
    def sayHello():

How can I use this class on the python console once I’ve run the script on the text editor?

Thank you very much for your time.

For something like this I would start with getting the code working in vanilla Python first. I’m not sure you could easily prototype this using the Python Console. I don’t have code in front of me, but I think it was as simple as this might work.

# file
def foo_func():
    print("hello from!")

# file
from foo import foo_func

Save both files in same directory, then run from a command line terminal or Python’s Idle editor.