Pass variable between python scripts

前端 未结 5 1126
北恋
北恋 2020-12-02 18:37

I\'m sure this is very simple but I\'ve been unable to get it working correctly. I need to have my main python script call another python script and pass variables from the

5条回答
  •  情歌与酒
    2020-12-02 19:11

    use the following script:

    first.py:

    x=5
    

    second.py

    import first
    print first.x
    

    this will print the x value. Always imported script data should be referenced with the script name, like in first.x

提交回复
热议问题