<https://forum.vectorworks.net/index.php?/topic/45379-global-variables-with-imported-functions/#comment-231633>
<http://schema.org/text>
"Some tips:\n \n\n\n\t- A file is a module, which is a unit with stuff that work together. You'll never split it up. Things that belong together in a module should stay together.\n \n\n\n\t- Never use global variables, there are always better ways. Functions should almost always stand on their own, unless it's a function inside a class that needs the 'state' of the class.\n \n\n\n\t- use good names for your vars, so it's clear what they are, if you revisit your code years later, you want to know how it works, good naming will help with that.\n \n\n\n\t- use oop, so that the code is more clear and each thing is self-contained. It will make your code better, readable, etc....\n \n\n\n\tHere is a better version of your code (at the top of my head, did not test it, depending on what you are trying to achieve, this could be made far better, some imports are missing, i'm not using my standard IDE right now.)\n \n\n\nimport vs\n\nclass Shape(object, metaclass=ABCMeta):\n    \n    def __init__(self, origin: tuple, width: float, height: float):\n        \"\"\"\n        :type origin: (float, float)\n        \"\"\"\n        self.__origin = {x: origin[0], y: origin[1]}\n        self.__width = width\n        self.__height = height\n    \n    @property\n    def origin(self) -&gt; dict:\n        return self.__origin\n        \n    @property\n    def width(self) -&gt; float:\n        return self.__width\n        \n    @property\n    def height(self) -&gt; float:\n        return self.__height\n    \n    @abstractmethod\n    def draw(self):\n        pass\n    \n    \nclass Rectangle(Shape):\n    \n    def draw(self):\n        vs.Rect(self.origin.x, self.origin.y, self.origin.x + self.width, self.origin.y + self.height)\n        \n        \nclass Oval(Shape):\n    \n    def draw(self):\n        vs.Oval(self.origin.x, self.origin.y, self.origin.x + self.width, self.origin.y + self.height)\n\n\ndef run():\n    \n    plugin_length = vs.PLineLength\n    plugin_height = vs.PBoxWidth\n    \n    x = 0\n    y = 0 - plugin_height / 2\n    \n    vs.PenSize(2)\n    \n    if plugin_length == 6:\n        vs.AlrtDialog('Hello world.')\n        return\n    \n    my_shape_class = Rectangle if plugin_length &lt; 6 else Oval\n    my_shape = my_shape_class((x, y), plugin_length, plugin_height)\n    my_shape.draw()\n\n\n# This should not be needed here, you can call it in your plugin file itself.\nrun()\n\n\n\t \n \n"
<https://forum.vectorworks.net/index.php?/topic/45379-global-variables-with-imported-functions/#comment-231565>