Lets say I have a module called device which contains a class called ConfigureDevice. Lets also say that I have a module called comports which defines my com ports in a class called ComPorts (enum in C).
Now, lets say that the constructor for ConfigureDevice takes an argument called comPorts. The question is, should I import comports at the beginning of the device module or should the code creating ConfigureDevice make this import?
So, should import comports occur here:
# device module
import serialwriter
import comports
class ConfigureDevice:
def __init__(self, comPort):
self.serialWriter = serialwriter.SerialWriter(comPort)
Or should I import it in the code that creates ConfigureDevice, like this:
import device
import comports
...
device.ConfigureDevice(comports.ComPorts.COM_1)