Hello I ve a stupid pb that stucks me, I don t understand why the str argument in not taken into account :
Here is tst.py:
class CurrenciPair():
def __init__(self, market_pair):
self.market_pair = market_pair
def displayCount(self):
histo = market_pair
print(market_pair)
Outside the class:
def reco(market_pair):
print(market_pair)
emp = CurrenciPair(market_pair)
emp.displayCount()
Here is test.py that import the previous file:
import tst as tt
market = 'TEST'
tt.reco(market)
Here is the result:
>>python test.py
TEST
Traceback (most recent call last):
File "test.py", line 5, in <module>
tt.reco(market)
File "C:\Users\or2\Downloads\crypto\API\python_bot_2\tst.py", line 19, in reco
emp.displayCount()
File "C:\Users\or2\Downloads\crypto\API\python_bot_2\tst.py", line 10, in displayCount
histo = market_pair
NameError: name 'market_pair' is not defined