Open egtoney opened 9 years ago
So for this task I literally created four new .py files:
Each of these files contains the corresponding class from telemetry.py.
I copied and pasted the import statements from telemetry.py into each of the new files since I'm not sure which ones are necessary for the operation of each.
Then in PlottingDataMonitor.py I imported the other three new .py files with syntax below:
from Battery import Battery
from Motor import Motor
from MPPT import MPPT
Apparently if I use the form from UserDict1 import UserDict2
the attribute UserDict1
is directly imported into PlottingDataMonitor
's local namespace and referencing its module object UserDict2
in the program is not necessary.
Questions:
PlottingDataMonitor
, does it mean that PlottingDataMonitor.py is able to retrieve and use any of the other three file's variables and functions as if they physically exists in PlottingDataMonitor.py in the first place? In another word, do I have to do the MotorController.setSpeed()
business or instead I can just call it setSpeed()
?
The telemetry.py file needs to be split into an object oriented layout where each class has it's own file. Be careful of cyclical imports.