Hello all. I want to generate a Python class via a file. This is a very simple file, named testy.py:
def __init__(self,var):
print (var)
When I try to instantiate it I get:
>>> import testy
>>> testy('1')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable
Then , I try something else:
class testy_rev1:
def __init__(self,var):
print (var)
I try to instanicate it and I get:
>>> import testy_rev1
>>> a=testy_rev1('1')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable
>>> a=testy_rev1.testy_rev1('1')
1
What I am looking for is a way to import it from a file w/o resorting to:
import <module name>.<module name>