A domain specific addon or course needs to be initialized in order for a user to be able to use it. This is done by:
It is planned that a future version of Anki Script will provide a user interface to remove the need for these tasks.
Copying the ankiscript.py file
In Anki click the Tools > Add-ons menu item.
Then select the Anki Script addon and click 'View Files'. You should now see an ankiscript.py file.
A copy of this file should be placed in the course/domain specifc addon top-level directory .
Providing a meta.json file
The meta.json file is required by Anki. It specifies the addon name that the user sees in Anki. For example:
{"name": "Anki Script example course"}
This should be placed in the course/domain specifc addon top-level directory .
Providing an __init__.py file
As domain experts and course providers are unlikely to be programmers the __init__.py file required is a small amount of boilerplate code:
from .ankiscript import init_course

init_course('Some Domain', 
    help='help', 
    setup='setup')
This should be placed in the course/domain specifc addon top-level directory .
If the addon is used to provide a course that progressively develops the only difference required in the __init__.py file is that a list of lessons is added along with a menu location for the associated menu items: ...
from .ankiscript import init_course

init_course('Anki Script example course', 
    help='help', 
    setup='setup',
    lessons = [
        ('1: Verb infinitives', 'lesson1'),
        ('2: Present tense', 'lesson2'),
        ('3: Past tense', 'lesson3'),
        ('4: Verb aspects', 'lesson4')
    ],
    menu= 'Courses.Anki Script Example')
For more advanced uses there are more possible arguments to the init_course function: ...

def init_course(name, help=None, setup=None, lessons=None, menu=None, menuItems=None, syntax=None):
    """Register a course with Anki Script.
    
    Keyword arguments:
    name      -- course name
    help      -- directory / URL with course help, optional
    setup     -- directory / URL with addon initialization data, only required if the course requires initialization
    lessons   -- list of name, directory / URLs, only required if the course has separate lessons 
    menu      -- menu to use for course actions, defaults to course name.
    menuItems -- additional menu items as a list of name, callback pairs, optional.
    syntax    -- function called with a single Parser arg to set up parsing using a different syntax from default one
    """
Custom menu
The menu defaults to the addon name if no menu is specified and lessons and/or custom actions are defined.
No menu is added for the course if there are no actions for it (ie. it has no lessons and custom actions).
The course actions can be added to a submenu by using a dot '.' in the menu name to specify the menu hierarchy. ...
So a menu location of Courses.Anki Script Example would result in the user seeing:
Custom menu actions
A list of custom menu actions may be specified - these appear in a separate section of the domain specific / course addon menu.
For additional menu items the callbacks must take the course object as the only parameter. These are added as additional menu items at the end of the course menu, and enable custom actions to be added for a course. Providing a single value of None instead of a pair will add a menu separator.
The Anki Script example course addon contains an example custom menu action that illustrates this:

def about(course):
    from aqt.utils import showInfo
    showInfo('About ' + course.name)

init_course('Anki Script example course',
    ... 
    menuItems=[
        ('About', about)
    ])
Help
Help information may be provided for the addon via the help argument.
Help information can be displayed by a script, for instance to provide instructions on any actions that they need to do after running a script.
The help information may be bundled in the addon in its own directory , or hosted on an external website and the URL passed to the init_course function.
Custom syntax
The supplied script syntax can be extended or replaced by a custom one .