Implementing a plug-in mechanism

Loris Bennett loris.bennett at fu-berlin.de
Wed Mar 15 08:47:43 EDT 2023


Hi,

I have written a program which, as part of the non-core functionality,
contains a module to generate email.  This is currently very specific
to my organisation, so the main program contains

  import myorg.mailer  

This module is specific to my organisation in that it can ask an
internal server to generate individualised salutations for a given UID
which is known within the organisation.

I want to share the code with other institutions, so I would like to 

  1. replace the organisation-specific mailer with a generic one
  2. allow an organisation-specific mailer to be used instead of the
     generic one, if so desired

Is importlib the way to go here or is there another approach?

Cheers,

Loris
 
-- 
This signature is currently under constuction.


More information about the Python-list mailing list