Skip to content Skip to sidebar Skip to footer

How To Run A File From Another Python File

a.py from kivy.app import App from kivy.uix.dropdown import DropDown from kivy.lang import Builder class CustDrop(DropDown): def __init__(self, **kwargs): super(CustD

Solution 1:

The solution is as follow:

Snippet

a.py

...kv_str=Builder.load_string('''#:import os os...CustDrop:id:dropdownButton:text:'Run another script'size_hint_y:Noneheight:'48dp'on_release:os.system("python3b.py")

Output

enter image description hereenter image description here

Solution 2:

instead of calling to system, there is a python module to do that

https://docs.python.org/3/library/runpy.html

Post a Comment for "How To Run A File From Another Python File"