Home Get Variables to Use for Exec() from other file
Reply: 0

Get Variables to Use for Exec() from other file

user687
1#
user687 Published in June 19, 2018, 4:20 pm

I have a class file for python and I have a command called

dataEnviroment()

The contents of dataEnviroment():

def dataEnviroment():
while True:
    try:
        cmd = raw_input("jData> ");
        if cmd == "exit":
            exit();
        exec(cmd);
    except Exception as error:
        print("Error: " + str(error));

Now if I put this in the file that I import the my class module everything works smoothly. But, if I put this in the class file I can't do anything with the variables in the file I work in. And I can't import the file I work in because I am already importing the class file.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.298879 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO