import logging, configparser, sys, os, json, time, logging, sseclient, urllib3,re, threading, pandas as pd, datetime, requests from PyQt5.QtWidgets import QApplication, QWidget, QGridLayout logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s: %(message)s') from strategy.w_BigMidSmall_liangbi_pool import w_bms_liangbi class thread1(threading.Thread): def __init__(self): super(thread1, self).__init__() self.ok = 'ok' def func1(self,arg): print('func1', arg) class thread2(threading.Thread): def __init__(self): global thread1 #把父类定义成全局变量 threading.Thread.__init__(self) def run(self) -> None: print('i am sub') thread1.func1(self, 1) #调用全局变量(父类)的函数,如果调用属性则要实例化 thread1.func1(self, thread1().ok) def run(self) -> None: print('i am main') t1 = self.thread2() t1.start() t = thread1() t.start()
12-25
09-15
491
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-27