dimanche 25 octobre 2020

How to provide an argument when importing a Python module containing class definitions?

I have a Python module which contains class definitions that needs to take an argument to configure these class definitions.

More specifically, the module contains SQLAlchemy ORM models, and the argument should e.g. be the string length for String() columns.

I don't think it's possible to provide an argument to the import mymodule statement, so what's the canonical (or best-practice) way for achieving similar functionality?

Aucun commentaire:

Enregistrer un commentaire