Plex and Python ... how do I run a simple python script to list my movies

The install saga continues … I have a new new plex set up on the new server but I lost all of my config stuff on plex (movies posters, collections, etc). For some reason, the watch / not watched seems to have ported over … but my collections are gone :frowning:

So … python with a list of movies and tags / collectdions is my solution (just so I don’t have to do it manually) … but … how can I get python to list my movies as a starting point?

This is what I have … but it will not import PlexServer … and I am wary of just installing the plexapi.server module.

from plexapi.server import PlexServer
def main():
    
    # Connect to Plex Media Server. Replace PLEX_TOKEN below with your Plex token. How to get token: https://www.plexopedia.com/plex-media-server/general/plex-token/
    baseurl = 'http://local ip:32400'
    token = 'hash hash'

    plex = PlexServer(baseurl, token)
    for section in plex.library.sections():
        if section.type == 'movie':
            for movie in section.all():
                print(movie.title)


if __name__ == '__main__':
    main()