Python string variable as object : <p>I am trying to pass the name of one of my objects as a variable within a function, however when executing the function it is only being recognised as a string, returning the following error:</p>

<pre><code>AttributeError: 'str' object has no attribute 'method'
</code></pre>

<p>my code is as follows:</p>

<pre><code>def addTask(arg1, arg2):
    arg1.method('arg2')

addTask('object-type','foo')
</code></pre>

<p>So object-type is being passed as a string, but i need it to be converted to an object.  I have tried eval, but that doesn't work, wondering if anyone can help me please.</p>

<p>Thanks.</p>
