In Python 3.2 how would I dynamically open and compile a class from a specified file?
<p>Code is much more precise than English; Here's what I'd like to do:</p>

<pre><code>import sys

fileName = sys.argv[1]
className = sys.argv[2]

# open py file here and import the class
# ???

# Instantiante new object of type "className"
a = eval(className + "()") # I don't know if this is the way to do that.

# I "know" that className will have this method:
a.writeByte(0x0)
</code></pre>

<p><em>EDIT:</em></p>

<p>Per the request of the answers, here's what I'm trying to do:</p>

<p>I'm writing a virtual processor adhering to the SIC/XE instruction set.  It's an educational theoretical processor used to teach the fundamentals of assembly language and systems software to computer science students.  There is a notion of a "device" that I'm trying to abstract from the programming of the "processor."  Essentially, I want the user of my program to be able to write their own device plugin (limited to "read_byte" and "write_byte" functionality) and then I want them to be able to "hook up" their devices to the processor at command-line time, so that they can write something like:</p>

<p><code>python3 sicsim -d1 dev1module Dev1Class -d2 ...</code> </p>

<p>They would also supply the memory image, which would know how to interact with their device.  I basically want both of us to be able to write our code without it interfering with each other.</p>
