I've been programming in Python recently
I have 2 python file A.py and B.py
in B.py i have the following code
B.py
import A
import ...
async def main():
cc = 'ethusdt'
url = f'wss://stream.binance.com:9443/stream?streams={cc}@miniTicker'
async with websockets.connect(url) as client:
while True:
data = json.loads(await client.recv())['data']
event_time = time.localtime(data['E'] // 1000)
event_time = f"{event_time.tm_hour}:{event_time.tm_min}:{event_time.tm_sec}"
date_time = event_time
price = float(data['c'])
A.reciv_data(date_time,price))
if __name__ == "__main__":
asyncio.run(main())
A.py
def reciv_data(a,b):
x=a
y=b
print(x)
print(y)
Which constantly receives information from the server and prints it
I need B.py information in A.py so that when i run A.py first B.py start running and constantly receive information and in A.py give me to do those calculations Given that the data in B.py is constantly being updated, how can I have this data in A.py ? Thank you for your help
A.pyandB.py? Can you add some more detail? I seeB.pyalready importsA.py...