I need to access the variable from main.py to global_rrt.py. I need to access the variable serial_rrt_read in global_rrt.py under the calss frame_101.
global_rrt.py global serial_rrt,serial_rrt_read #Read data from RS232 port of fast charger global serial_length #Determine the length of serial read from fast charger from main import* print serial_rrt_read class frame_101: frame_101_serial = "1111111100000000" frame_101_start = frame_101_serial[0:8] frame_101_f_id = frame_101_serial[8:16] frame_101_end = frame_101_serial[632:640] frame_101_data = frame_101() #print frame_101_data.frame_101_serial
main.py import time #Deals with date and time #import serial #Acess for Serial Port import subprocess #Allows us to spawn processes import os #Provides a way of using operating system dependent functionality import sys #Access variables used or maintained by the interpreter from global_rrt import* #Access Global Variables in Main File #Start Reading Serial Port Data #serial_rrt = serial.Serial('/dev/ttyACM1', 9600, timeout=1) while 1: #serial_rrt_read = ser.readline() serial_rrt_read = "1111111100000000" #print serial_rrt_read serial_length = len(serial_rrt_read) #print serial_length if(serial_length == 16): frame_101_data = frame_101() print "Hi" print frame_101_data.frame_101_serial