Is it possible to copy a module, and then make changes to the copy? To phrase another way, can I inherit from a module, and then override or modify parts of it?
Is it possible to copy a module, and then make changes to the copy? To phrase another way, can I inherit from a module, and then override or modify parts of it?
To phrase another way, can I inherit from a module, and then override or modify parts of it?
Yes.
import module
You can use stuff from module
or override stuff in your script.
You can also do this to create a "derived" module.
Call this "module_2".
from module import *
Which imports everything. You can then use stuff from module
or override stuff in this new module, "module_2".
Other scripts can then do
import module_2
And get all the stuff from module modified by the overrides in module_2.