Following example in docu leads to error on "from <the_module> import Session"

trying to learn about scripting with python I tried to follow the instructions in the documentation.
https://help.libreoffice.org/latest/en-US/text/sbasic/python/python_session.html
I’m using LO 7.5 and have the APSO extension installed.

Trying to follow the example to get Session information I opened the APSO console and entered the first command:

from <the_module> import Session

I get the following error

from <the_module> import Session
  File "<console>", line 1
    from <the_module> import Session
         ^
SyntaxError: invalid syntax

It looks to me like <the_module> statement is incorrect.
I’m not a python expert, and this is the first time I see this type of from statement using <>
What is this <the_module> library? As far I know python there should be a the_module.py somwhere …?

Any help understanding this would be appreciated.

Hallo
it seems <the_module> is just a placeholder for the name of the python-module with the code of the Session-class (the code below Python Session Class from your link)

For an excellent recource on Python and LibreOffice see:
OOO Development Tools (OooDev).

Also See: LibreOffice Python UNO Examples for many various python examples.

Full disclosure, I am a developer for both of these resources.

@vib: What is the point of overwhelming a beginner who is still struggling with basic concepts with more “boilerplate” information?

1 Like

Hi Vib, that looks like good stuff for further exploration and experimentation.
Looks like @karolus has the answer, I need to create a module with the Session class as shown in the example.
I just need to figure out where to put that module so that the LO python can find it.
By the way I forgot to mention that I’m on Windows.

Thanks to both for your help.

In my experience it is much easier to learn with lots of examples and the resources I shared have lots and lots of examples.